Microblogging API how to crawl other unauthorized users of microblogging/How to crawl the specified user posted Weibo

Source: Internet
Author: User

Get a list of the latest tweets from a user: Http://open.weibo.com/wiki/2/statuses/user_timeline the original interface has been blocked. Many people are asking how to get a specific user's microblog, so write this blog.

This article by @the_third_wave (blog address: http://blog.csdn.net/zhanh1218) original. Do not update regularly, please correct me if there are any errors.

Sina Weibo attention: @The_third_wave

If this blog is helpful to you, for good network environment, do not recommend reprint, recommend collection. If you must reprint, please bring the suffix and this address.

"Get a user's latest microblogging list" interface notes are as follows: get their own microblogging, parameter UID and screen_name can not fill out, then automatically get the current user's microblog; Specify the microblogging for others, parameter UID and Screen_name both must choose one, And can only choose one; after the interface upgrade: UID and screen_name can only be current authorized users, third party microblogging clients are not affected; Read the latest microblogging list for all the current authorized users, using: Get the latest microblogging interface for current authorized users and their users of interest (statuses/ Home_timeline); This interface only returns the latest 2000 data; workaround But the fourth note gives us a way to get the latest microblogging interface for the current authorized user and the users they care about. In other words, you can create an account that does not publish Weibo, only the users we need to crawl. Then it's settled. Get the latest microblogging for the current logged-on user and the user they are interested in: Http://open.weibo.com/wiki/2/statuses/home_timeline


And there is no return limit for the number of bars.

The code example is:

Client = Apiclient (App_key=app_key, App_secret=app_secret, redirect_uri=redirect_url)
Callback_url = client.get_ Authorize_url ()
print callback_url   
API = Sinaapi (Callback_url, App_key, Redirect_url, User, passwd) # This is the interface I wrote for myself , automatically gets the code's value
code = api.get_code_security ()
requests = Client.request_access_token (code)  
Access_token = Requests.access_token # Sina returns token, similar to abc123xyz456  
expires_in = requests.expires_in  
# set to get Access_token  
Client.set_access_token (Access_token, expires_in)  
statuses = Client.statuses__home_timeline () # Get Data

API = Sinaapi (Callback_url, App_key, Redirect_url, User, passwd) # This is my own written interface, automatically gets the value of the code. Download Address: (@The_Third_Wave) Python: Sina Weibo API usage and secure analog login automatically get code value: http://blog.csdn.net/zhanh1218/article/details/26383469

New methods will be updated irregularly. Print information:

Str_sta = Json.dumps (statuses)
text_list = Re.findall (r "(? <=\" text\ ": \"). *? =\ ",)", Str_sta) for
text in text_list:
    Weibo = eval ("U" + "'" +text+ "") 
    print Weibo

This article by @the_third_wave (blog address: http://blog.csdn.net/zhanh1218) original. Do not update regularly, please correct me if there are any errors.

Sina Weibo attention: @The_third_wave

If this blog is helpful to you, for good network environment, do not recommend reprint, recommend collection. If you must reprint, please bring the suffix and this address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.