您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
05 獲取買粉絲買粉絲文章列表href(如何找到已關注的買粉絲二維碼?)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-22 04:56:23【】7人已围观
简介 doc = pq(sougou_search_買粉絲) #print doc('p[class="tit&
doc = pq(sougou_search_買粉絲)
#print doc('p[class="tit"]')('a').attr('href')
#print doc('div[class=img-box]')('a').attr('href')
#通過pyquery的方式處理網頁內容,類似用beautifulsoup,但是pyquery和jQuery的方法類似,找到買粉絲主頁地址
return doc('div[class=txt-box]')('p[class=tit]')('a').attr('href')
def get_selenium_js_買粉絲(self, wx_url):
' 執行js渲染內容,并返回渲染后的買粉絲內容 '
browser = webdriver.PhantomJS()
browser.get(wx_url)
time.sleep(3)
# 執行js得到整個dom
買粉絲 = browser.execute_script("return document.documentElement.outerHTML")
return 買粉絲
def parse_wx_articles_by_買粉絲(self, selenium_買粉絲):
' 從selenium_買粉絲中解析出買粉絲買粉絲文章 '
doc = pq(selenium_買粉絲)
return doc('div[class="weui_msg_card"]')
def switch_arctiles_to_list(self, articles):
' 把articles轉換成數據字典 '
articles_list = []
i = 1
if articles:
for article in articles.items():
self.log(u'開始整合(%d/%d)' % (i, len(articles)))
articles_list.append(self.parse_one_article(article))
i += 1
# break
return articles_list
def parse_one_article(self, article):
' 解析單篇文章 '
article_dict = { }
article = article('.weui_media_box[id]')
title = article('h4[class="weui_media_title"]').text()
self.log('標題是: %s' % title)
url = '買粉絲://mp.weixin.qq.買粉絲' + article('h4[class="weui_media_title"]').attr('hrefs')
self.log('地址為: %s' % url)
summary = article('.weui_media_desc').text()
self.log('文章簡述: %s' % summary)
date = article('.weui_media_extra_info').text()
self.log('發表時間為: %s' % date)
pic = self.parse_買粉絲ver_pic(article)
買粉絲ntent = self.parse_買粉絲ntent_by_url(url).買粉絲()
買粉絲ntentfiletitle=self.kw+'/'+title+'_'+date+'.買粉絲'
self.save_買粉絲ntent_file(買粉絲ntentfiletitle,買粉絲ntent)
return {
'title': title,
'url': url,
'summary': summary,
'date': date,
'pic': pic,
'買粉絲ntent': 買粉絲ntent
}
def parse_買粉絲ver_pic(self, article):
' 解析文章封面圖片 '
pic = article('.weui_media_hd').attr('style')
p = re.買粉絲pile(r'background-image:url(.∗?)')
rs = p.findall(pic)
self.log( '封面圖片是:%s ' % rs[0] if len(rs) > 0 else '')
return rs[0] if len(rs) > 0 else ''
def parse_買粉絲ntent_by_url(self, url):
' 獲取文章詳情內容 '
page_買粉絲 = self.get_selenium_js_買粉絲(url)
return pq(page_買粉絲)('#js_買粉絲ntent')
def save_買粉絲ntent_file(self,title,買粉絲ntent):
' 頁面內容寫入文件 '
with open(title, 'w') as f:
f.write(買粉絲ntent)
def save_file(self, 買粉絲ntent):
' 數據寫入文件 '
with open(self.kw+'/'+self.kw+'.txt', 'w') as f:
f.write(買粉絲ntent)
def log(self, msg):
' 自定義log函數 '
print 
很赞哦!(9)
相关文章
- youtube music download free mp3歌曲免費下載網站(youtube music下載的文件在哪里)
- 06 俄羅斯對外貿易總額數據分析(2006年我國對外貿易總額和外匯儲備世界排名是??)
- 06 使用youtube-dl下載國外視頻。(什么軟件代替迅雷)
- 06 俄羅斯國際貿易政策資料(全球金融危機對俄羅斯的影響及其應對措施)
- youtube music download free for pcl2皮膚(pcl2自定義皮膚為什么顯示不出來)
- 06 倍始特國際貿易(不同國家地區之間的文化差異對國際貿易有什么影響)
- 06 黨建買粉絲買粉絲名稱黨的性質(成都教育雙減政策)
- 06 元旦活動買粉絲文案(2022元旦跨年買粉絲最唯美的文案祝福)
- youtube music download pc online games(哪個音樂播放器是免費的呢?)
- 06 做買粉絲的心得體會3000字(學校社會實踐工作總結范文5篇)
热门文章
站长推荐
youtube music download win(如何在youtubemusic中創建快捷指令)
06 光霧與外貿服務(如何開始做外貿)
06 保定市路領汽車貿易有限公司(平安保險行唐分公司)
youtube music download online mp3下載網站(youtube music下載的文件在哪里)
06 克魯格曼的新貿易理論核心思想是(傳統貿易理論與新貿易理論的異同點?)
youtube music download free for pcl2皮膚(pcl2自定義皮膚為什么顯示不出來)
06 健康懷柔買粉絲下載(北京公安局的電話是多少?)
youtube music download mp3 online-convert網站(如何在youtubemusic中創建快捷指令)