SHARE
TWEET

None

a guest Jan 18th, 2020 92 in 20 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2.  
  3. # pip install weibo-scraper
  4.  
  5. pages = 1 # None for all tweets
  6. uid = 3170688522
  7.  
  8. #import json
  9. from weibo_scraper import get_weibo_profile as profile
  10. from weibo_scraper import get_weibo_tweets_by_name as tweets
  11.  
  12. for tweet in tweets(name = profile(uid = uid).screen_name, pages = pages):
  13.     """
  14.     print(json.dumps([
  15.         tweet["mblog"]["created_at"],
  16.         "https://m.weibo.cn/detail/" + tweet["mblog"]["id"],
  17.         tweet["mblog"]["text"].replace("<br />", "\n"),
  18.         tweet["mblog"].get("original_pic", None),
  19.     ]))
  20.     """
  21.     print(tweet["mblog"]["created_at"]
  22.         .replace("刚刚", "just now")
  23.         .replace("分钟前", " minute(s) ago")
  24.         .replace("小时前", " hour(s) ago")
  25.         .replace("昨天", "yesterday")
  26.     )
  27.     print("https://m.weibo.cn/detail/" + tweet["mblog"]["id"])
  28.     print(tweet["mblog"]["text"].replace("<br />", "\n"))
  29.     print(tweet["mblog"].get("original_pic", ""), end = "\n\n")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top