最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - How can I see search or view youtube community posts older than 200? - Stack Overflow

programmeradmin0浏览0评论

I'm trying to view old community posts that I remember but youtube limits how much community posts load. It happens on all channels. The community posts aren't deleted. If you have the links you can still get to the posts for example but besides that you can't get to older community posts.

I can also see a problem with archiving and lost media if some youtube posts don't get saved.

I tried using some Community Post Scraper to archive such as but they didn't work pass 200 community posts I tried using python and java code with youtube api to try to see if I can retrieve youtube community posts with trying to find the urls but nothing worked If anyone can find a solution please let me know.

I was able to get this working for videos but not community posts.

import requests

api_key = "insert"

base_url = ";

def youtube_search(query, max_results=10):
    params = {
        "part": "snippet",
        "q": query,
        "type": "video",  
        "maxResults": max_results,
        "key": api_key
    }

    
    response = requests.get(base_url, params=params)

    
    if response.status_code == 200:
        results = response.json()
        videos = []
        
        
        for item in results.get("items", []):
            video_data = {
                "title": item["snippet"]["title"],
                "channel": item["snippet"]["channelTitle"],
                "video_url": f"={item['id']['videoId']}"
            }
            videos.append(video_data)
        
        return videos
    else:
        print("Error:", response.status_code, response.text)
        return []


search_query = "Python programming tutorials"
search_results = youtube_search(search_query)

for idx, video in enumerate(search_results, start=1):
    print(f"{idx}. {video['title']} (by {video['channel']})")
    print(f"   Watch here: {video['video_url']}")
发布评论

评论列表(0)

  1. 暂无评论