- #!/usr/bin/env python
- # encoding: utf-8
- import sys
- import requests
- from bs4 import BeautifulSoup
- reload(sys)
- sys.setdefaultencoding("utf8")
- text = requests.get("https://www.stock4p.com/").text
- bs4 = BeautifulSoup(text)
- excerpts = bs4.select(".excerpt")
- post_url = []
- for exce in excerpts:
- h = exce.select_one("header h2 a").attrs['href']
- post_url.append(h)
- # post_url = ['https://www.stock4p.com/2020/06/13/pyppeteer%e6%8a%93%e5%8f%96%e6%95%b0%e6%8d%ae%e4%b9%8b%e7%9b%b4%e6%8e%a5%e6%8a%93%e5%8f%96http%e8%af%b7%e6%b1%82/']
- post_data = '\n'.join(post_url)
- #
- #
- t = requests.post("http://data.zz.baidu.com/urls?site=www.stock4p.com&token=123456", data=post_data).text
- #
- print t
- #
- #
如何使用python推送百度站长收录数据
最新推荐文章于 2024-07-23 03:42:01 发布