hezhang1994 / weibo-crawler Goto Github PK
View Code? Open in Web Editor NEWTo crawl Sina Weibo data (text, JPG/GIF images, live photos, and videos). [简单实用] 爬取新浪微博用户所发表或转发的文本、JPG/GIF图片、实况照片和视频。
License: MIT License
To crawl Sina Weibo data (text, JPG/GIF images, live photos, and videos). [简单实用] 爬取新浪微博用户所发表或转发的文本、JPG/GIF图片、实况照片和视频。
License: MIT License
因为某些微博表情无法解码保存。
It seems I can only find "getdashinfoxxx" and "proxy?xxx" on my XHR tag. Is there other ways to find the containder id? Thankss
Sometimes, the value of time_list could be ['N/A\r'] (def time_str2float). It may mean the video missed. Then, it would break.
My temporary solution is that set 'time_num = 0', if the 'N/A\r' appears. However, I do not know if it would cause unknown flaws.
It happens at the following code:
if card['mblog']['isLongText'] == 'False': ... else: ...
In details, when card['mblog']['isLongText'] = False, the code still excutes the else content.
If the cookie is expired, the crawling process will stop.
How to crawl video?
Currently, this implementation can not crawl images posted in transferred text.
换了不同人的账号,一到live photo就会报错
FileNotFoundError: [WinError 2] 系统找不到指定的文件
谢谢
Error message:
Traceback (most recent call last):
File "H:/prbkp/weibo-crawler/run_WeiboCrawler.py", line 245, in
photo_str = card['mblog']['pic_video']
KeyError: 'pic_video'
I do not know why it appeared. I just use:
if card_info:
if 'pic_video' in card_info:
try:
photo_str = card['mblog']['pic_video']
photo_list = re.split('[,]', photo_str)
for photo in photo_list:
# E.g., 'photo' = '0:000voDMsjx07t57qM583010f0100alDF0k01'.
photo_code = re.split('[:]', photo)[1]
photo_url = photo_url_start + photo_code + photo_url_end
photo_urls.append(photo_url)
except:
pass
to skip the part of code to prevent sudden interruption.
Hope it can help for further improvement.
If the cookie is expired, the crawling process will stop.
How to crawl videos?
How to crawl GIFs?
It seems like this code cannot crawl video from re-tweeted post.
see "bmiddle_pic" under "retweeted_status" and modify the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.