Javascript 如何获取网站所有页面的链接以进行数据抓取
我一直在开发一个程序,该程序使用PHP中的正则表达式从网站的特定页面抓取数据Javascript 如何获取网站所有页面的链接以进行数据抓取,javascript,php,Javascript,Php,我一直在开发一个程序,该程序使用PHP中的正则表达式从网站的特定页面抓取数据 <?php ini_set("user_agent", "PHP"); $url = "http://www.example.com/page.html"; $output = file_get_contents($url); preg_match('#<h1 class="title&
<?php
ini_set("user_agent", "PHP");
$url = "http://www.example.com/page.html";
$output = file_get_contents($url);
preg_match('#<h1 class="title" itemprop="name">(.*)</h1>#', $output, $match);
echo $match[1] ."<br>";
?>
该使用@RodrigoDuterte了,请解释一下如何使用它
import bs4
for link in bs4.BeautifulSoup(urllib2.urlopen(target_url).read()).find_all("a"):
print link