保存网页中的动态内容?
是否可以从网站保存动态文本并将其转储到我的服务器上的文件中? 我感兴趣的具体情况是从此页面保存歌曲标题 http://www.z1035 .com/player.php 并将所有歌曲标题保存在我的服务器上的文件中。 这可能吗? 我可以使用什么方法来做到这一点?
Is it possible to save dynamic text from a website and dump it into a file on my server? The specific case that I'm interested in is saving the song title from this page http://www.z1035.com/player.php
and saving all the song titles in a file on my server. Is this possible? What methods could I use to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您所指的通常称为“抓取”。 这是一篇关于使用 PHP 执行此操作的一种方法的文章:
http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/
What you're referring to is generally known as 'scraping'. Here's an article about one way to do it with PHP:
http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/
在我看来,Python 的 URLLib 库使抓取变得非常容易。
这将加载外部资源,就好像它是本地文件一样,并允许您根据需要对其进行解析。
曾几何时,我想保存我听过的广播节目的所有曲目列表。 我使用 Python 下载所有曲目列表,然后以编程方式访问每个曲目并将内容附加到文件中。 它非常方便,大约需要 20 行。
Python's URLLib library makes scraping pretty easy, in my opinion.
This will load the external resource as if it were a local file, and allow you to parse it as necessary.
Once upon a time I wanted to save all the tracklistings for a radio show I listened to. I used Python to download a list of all the tracklistings, and then to programmatically visit each and append the contents to a file. It was very handy, and took probably 20 lines.