SELECT
field2,
CASE
WHEN INSTR(field2, '+82') > 0 THEN
SUBSTR(field2, INSTR(field2, '+82'))
ELSE
field2
END AS extracted_value
FROM firefox_website_02;
firefox_website_02.pl
use strict;
use warnings;
# Initialize variables to store extracted URLs
my @google_maps_urls;
# Process each HTML file (1.html to 25.html)
for my $file_number (1..25) {
my $input_file = "${file_number}.html";
# Open the current input file for reading
open my $input_fh, '<', $input_file or warn "Cannot open input file '$input_file': $!";
my $previous_line = '';
my $current_line = '';
my $extracting = 0;
# Read each line and look for URLs
while (my $line = <$input_fh>) {
chomp $line;
# Check if the current line contains "+82"
if ($current_line =~ /\+82/) {
# Check if the next line contains "Website"
if ($line =~ /Website/) {
$extracting = 1;
push @google_maps_urls, "$input_file, $current_line";
}
}
# Continue extracting 3 more lines if we're in an extraction state
if ($extracting) {
push @google_maps_urls, "$input_file, $line";
if (@google_maps_urls % 4 == 0) {
$extracting = 0;
}
}
# Store the current line for the next iteration
$previous_line = $current_line;
$current_line = $line;
}
# Close the current input file
close $input_fh;
}
# Save the extracted URLs to a file
my $output_file = 'firefox_website_02.txt';
open my $output_fh, '>', $output_file or die "Cannot open output file '$output_file': $!";
foreach my $url (@google_maps_urls) {
print $output_fh "$url\n";
}
# Close the output file
close $output_fh;
print "Extraction complete. Extracted 4 lines (including +82 and Website) are saved in '$output_file'\n";
firefox_02.pl
use strict;
use warnings;
# Initialize an array to store extracted content
my @extracted_content;
# Process each HTML file (1.html to 25.html)
for my $file_number (1..25) {
my $input_file = "${file_number}.html";
# Open the current input file for reading
open my $input_fh, '<', $input_file or warn "Cannot open input file '$input_file': $!";
# Read each line and look for URLs and +82 content
while (my $line = <$input_fh>) {
chomp $line;
# Extract URLs matching /https:\/\/www\.google\.com\/maps\/place/
if ($line =~ /https:\/\/www.google.com\/maps\/place/) {
# Remove leading '<' and trailing '>'
$line =~ s/^<(.+)>$/$1/;
push @extracted_content, "$input_file,$line";
}
# Extract content starting with +82 and going to the end of the line
if ($line =~ /\+82(.+)/) {
my $plus82_content = "+82$1"; # Include +82 in the extracted content
push @extracted_content, "$input_file,$plus82_content";
}
}
# Close the current input file
close $input_fh;
}
# Save the extracted content to a file
my $output_file = 'firefox_02.txt';
open my $output_fh, '>', $output_file or die "Cannot open output file '$output_file': $!";
foreach my $entry (@extracted_content) {
print $output_fh "$entry\n";
}
close $output_fh;
print "Extraction complete. Extracted content is saved in '$output_file'\n";
google sheet – 15 30 45 .. 820 borderline macro
function border_151() {
var spreadsheet = SpreadsheetApp.getActive();
// Define the starting and ending row numbers (15 and 820).
var startRow = 15;
var endRow = 820;
// Loop through rows in increments of 15 and set the border.
for (var row = startRow; row <= endRow; row += 15) {
spreadsheet.getRange('A' + row + ':B' + row).setBorder(null, null, true, null, null, null, '#000000', SpreadsheetApp.BorderStyle.SOLID);
}
}
Seoul.html – 서울 25개 구, Firefox search tabs automation
<!DOCTYPE html>
<html>
<head>
<title>Open Search Words in Reverse Order</title>
</head>
<body>
<script>
var searchWords = [
"한의원 중랑구 서울특별시",
"한의원 중구 서울특별시",
"한의원 종로구 서울특별시",
"한의원 은평구 서울특별시",
"한의원 용산구 서울특별시",
"한의원 영등포구 서울특별시",
"한의원 양천구 서울특별시",
"한의원 송파구 서울특별시",
"한의원 성북구 서울특별시",
"한의원 성동구 서울특별시",
"한의원 서초구 서울특별시",
"한의원 서대문구 서울특별시",
"한의원 마포구 서울특별시",
"한의원 동작구 서울특별시",
"한의원 동대문구 서울특별시",
"한의원 도봉구 서울특별시",
"한의원 노원구 서울특별시",
"한의원 금천구 서울특별시",
"한의원 구로구 서울특별시",
"한의원 광진구 서울특별시",
"한의원 관악구 서울특별시",
"한의원 강서구 서울특별시",
"한의원 강북구 서울특별시",
"한의원 강동구 서울특별시",
"한의원 강남구 서울특별시"
];
for (var i = 0; i < Math.min(25, searchWords.length); i++) {
window.open("https://www.google.com/search?q=" + encodeURIComponent(searchWords[i]), "_blank");
}
</script>
</body>
</html>
Skype Call
<!DOCTYPE html>
<html>
<head>
<title>Call Option Prompt</title>
</head>
<body>
<h1>Welcome to Our Website</h1>
<p>Choose how you want to make a call:</p>
<!-- Skype Button -->
<button id="skypeButton">Use Skype</button>
<!-- Regular Phone Button -->
<button id="phoneButton">Use Regular Phone</button>
<script>
// Function to handle Skype call
function makeSkypeCall() {
// Use Skype URI scheme to initiate a Skype call
window.location.href = 'skype:username?call';
}
// Function to handle regular phone call
function makePhoneCall() {
// Replace 'phone_number' with the actual phone number
window.location.href = 'tel:+1234567890';
}
// Add event listeners to the buttons
document.getElementById('skypeButton').addEventListener('click', makeSkypeCall);
document.getElementById('phoneButton').addEventListener('click', makePhoneCall);
</script>
</body>
</html>
Google Map Business Link from Firefox Extraction Perl
use strict;
use warnings;
# Initialize variables to store extracted URLs
my @google_maps_urls;
# Process each HTML file (1.html to 25.html)
for my $file_number (1..25) {
my $input_file = "${file_number}.html";
# Open the current input file for reading
open my $input_fh, '<', $input_file or warn "Cannot open input file '$input_file': $!";
# Read each line and look for URLs
while (my $line = <$input_fh>) {
chomp $line;
if ($line =~ /https:\/\/www\.google\.com\/maps\/place/) {
# Remove leading '<' and trailing '>'
$line =~ s/^<(.+)>$/$1/;
push @google_maps_urls, $line;
}
}
# Close the current input file
close $input_fh;
}
# Save the extracted URLs to a file
my $output_file = 'extracted.txt';
open my $output_fh, '>', $output_file or die "Cannot open output file '$output_file': $!";
foreach my $url (@google_maps_urls) {
print $output_fh "$url\n";
}
# Close the output file
close $output_fh;
print "Extraction complete. Extracted URLs are saved in '$output_file'\n";
서울 구글 맵 Phone Extract – ORIGINAL
#!/usr/bin/perl
use strict;
use warnings;
use HTML::TokeParser;
# Input file containing a list of file names
my $file_list = 'moving_seoul.txt';
# Output file for saving extracted phone numbers
my $output_file = 'moving_seoul_extracted.txt';
# Open the file list for reading
open my $file_list_fh, '<', $file_list or die "Cannot open file list '$file_list': $!";
# Open the output file for writing
open my $output_fh, '>', $output_file or die "Cannot open output file '$output_file': $!";
# Iterate through each file listed in the input file
while (<$file_list_fh>) {
chomp; # Remove newline characters
my $input_file = $_;
# Open the current input file for reading
open my $input_fh, '<', $input_file or warn "Cannot open input file '$input_file': $!";
# Create an HTML::TokeParser object for the current input file
my $parser = HTML::TokeParser->new($input_fh);
my $extract = 0; # Flag to indicate whether to extract content between span and div tags
# Iterate through the tokens in the current input file
while (my $token = $parser->get_token) {
if ($token->[0] eq 'S') {
my $tag = $token->[1];
# Check if the tag is "span" or "div" with class attribute containing "UsdlK" or "W4Efsd"
my $class = $token->[2]->{class} || '';
if (($tag eq 'span' && $class =~ /UsdlK/) || ($tag eq 'div' && $class =~ /W4Efsd/)) {
$extract = 1; # Set the extract flag to start extracting
next; # Skip the current token
}
}
if ($extract && $token->[0] eq 'T') {
# Extract and print the text content
my $content = $token->[1];
print $output_fh "$content\n";
}
if ($extract && $token->[0] eq 'E') {
my $tag = $token->[1];
# Reset the extract flag when the closing span or div tag is encountered
if ($tag eq 'span' || $tag eq 'div') {
$extract = 0;
}
}
}
# Close the current input file
close $input_fh;
}
# Close the file list and output file
close $file_list_fh;
close $output_fh;
# Print a completion message
print "Extraction complete. Extracted content between <span class=\"UsdlK\">, <div class=\"W4Efsd\">, and their corresponding closing tags is saved in '$output_file'\n";
서울 구글 맵 extracting phone, adding file name extraction is from
#!/usr/bin/perl
use strict;
use warnings;
use HTML::TokeParser;
# Output file for saving extracted content
my $output_file = 'moving_seoul_extracted.txt';
# Open the output file for writing
open my $output_fh, '>', $output_file or die "Cannot open output file '$output_file': $!";
# Iterate through each file from 1.mhtml to 25.mhtml
for my $file_number (1..25) {
my $input_file = "${file_number}.mhtml";
# Open the current input file for reading
open my $input_fh, '<', $input_file or warn "Cannot open input file '$input_file': $!";
# Create an HTML::TokeParser object for the current input file
my $parser = HTML::TokeParser->new($input_fh);
my $extract = 0; # Flag to indicate whether to extract content between span and div tags
# Iterate through the tokens in the current input file
while (my $token = $parser->get_token) {
if ($token->[0] eq 'S') {
my $tag = $token->[1];
# Check if the tag is "span" or "div" with class attribute containing "UsdlK" or "W4Efsd"
my $class = $token->[2]->{class} || '';
if (($tag eq 'span' && $class =~ /UsdlK/) || ($tag eq 'div' && $class =~ /W4Efsd/)) {
$extract = 1; # Set the extract flag to start extracting
next; # Skip the current token
}
}
if ($extract && $token->[0] eq 'T') {
# Extract and write the text content along with the file name to the output file
my $content = $token->[1];
print $output_fh "$input_file: $content\n";
}
if ($extract && $token->[0] eq 'E') {
my $tag = $token->[1];
# Reset the extract flag when the closing span or div tag is encountered
if ($tag eq 'span' || $tag eq 'div') {
$extract = 0;
}
}
}
# Close the current input file
close $input_fh;
}
# Close the output file
close $output_fh;
# Print a completion message
print "Extraction complete. Extracted content with file names is saved in '$output_file'\n";
phone extract PYTHON code – FINAL
import re
import PyPDF2
import importlib
import subprocess
import csv
import os
def install_missing_package(package):
try:
importlib.import_module(package)
except ImportError:
subprocess.check_call(['pip', 'install', package])
def extract_phone_numbers_from_pdf(file_path):
phone_numbers = []
# Open the PDF file
with open(file_path, 'rb') as file:
# Create a PDF reader object
reader = PyPDF2.PdfReader(file)
# Iterate over each page in the PDF
for page in reader.pages:
# Extract the text from the page
text = page.extract_text()
# Use regular expressions to find phone numbers
# This pattern matches US phone numbers in various formats
pattern = r'(\+\d{1,2}\s?)?(\()?(\d{3})(?(2)\))[-.\s]?(\d{3})[-.\s]?(\d{4})'
matches = re.findall(pattern, text)
# Format the phone numbers as (###) ###-####
formatted_numbers = ['({}) {}-{}'.format(*match[2:]) for match in matches]
# Add the matched phone numbers to the list
phone_numbers.extend(formatted_numbers)
return phone_numbers
# Check if PyPDF2 is installed, and install it if necessary
install_missing_package('PyPDF2')
# Read the text file with a list of PDF file names
pdf_list_file = 'pdf_files.txt'
with open(pdf_list_file, 'r') as file:
pdf_files = file.read().splitlines()
# Extract phone numbers from each PDF and store them in a list
phone_number_list = []
for pdf_file in pdf_files:
phone_numbers = extract_phone_numbers_from_pdf(pdf_file)
phone_number_list.extend([(pdf_file, number) for number in phone_numbers])
# Write the extracted phone numbers to a CSV file
csv_file = 'phone_extracts.csv'
with open(csv_file, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['PDF Name', 'Phone Number'])
writer.writerows(phone_number_list)
# Print the success message
print(f"Phone numbers extracted from {len(pdf_files)} PDF files and saved to {csv_file}.")