Python異步解析主流視頻網站視頻信息框架

aioVextractor

Python異步解析主流視頻網站視頻信息框架

開發文檔
  1. docker便捷部署

    git clone https://github.com/panoslin/aioVextractor &&\
    cd aioVextractor &&\
    sudo chmod +x build.sh &&\
    sudo sh build.sh
    
  2. 接口體驗地址

  3. 使用

    from aioVextractor.api import (
        extract,
        breakdown,
        hybrid_worker
    )
    import aiohttp
    import asyncio
    
    async def test():
        async with aiohttp.ClientSession() as session:
            single_url = "https://creative.adquan.com/show/286788"
            playlist_url = "https://weibo.com/p/1005055882998192/photos?type=video#place"
            print(await extract(webpage_url=single_url, session=session))
            print(await hybrid_worker(webpage_url=single_url, session=session))
            print(await breakdown(webpage_url=playlist_url, session=session))
            print(await hybrid_worker(webpage_url=playlist_url, session=session))
    
    
    asyncio.run(test())
    

    以上提供最高級的 API 解析視頻網頁鏈接

    • extract: 解析單個視頻網址
    • breakdown: 解析整個播放列表網址
    • hybrid_worker: 自動檢測網頁是否爲 單個視頻網址/播放列表網址 並且返回對應結果
  4. 支持的網站

    • youtube
    • tvcf
    • vimeo
    • vmovier
    • iwebad
    • douyin
    • naver
    • hellorf
    • pinterest
    • digitaling
    • weibo
    • adquan
    • xinpianchang
    • carben
    • bilibili
    • tencent
    • instagram
    • lanfan
    • youku
    • renren
    • socialbeta
    • weixin
    • eyepetizer
  5. 測試Demo

    from aioVextractor.extractor.tencent import Extractor as tencentIE
    from pprint import pprint
    
    with tencentIE() as extractor:
        webpage_url = "https://v.qq.com/iframe/player.html?vid=c0912n1rqrw&tiny=0&auto=0"
        res = extractor.sync_entrance(webpage_url=webpage_url)
        pprint(res)
    
    """
    OUTPUT:
    [{'ad_link': None,
      'author': 'Apple 官方頻道',
      'author_attention': None,
      'author_avatar': None,
      'author_birthday': None,
      'author_description': None,
      'author_follwer_count': None,
      'author_follwing_count': None,
      'author_gender': None,
      'author_id': None,
      'author_sign': None,
      'author_url': 'http://v.qq.com/vplus/c855f20d041bc7e06f356522325b0902',
      'author_videoNum': None,
      'category': None,
      'cdn_url': None,
      'collect_count': None,
      'comment_count': None,
      'cover': 'http://vpic.video.qq.com/0/c0912n1rqrw.png',
      'description': None,
      'dislike_count': None,
      'download_count': None,
      'downloader': 'aria2c',
      'duration': '30',
      'forward_count': None,
      'from': 'tencent',
      'gender': None,
      'height': None,
      'language': None,
      'like_count': None,
      'play_addr': 'http://video.dispatch.tc.qq.com/uwMROfz2r5zIIaQXGdGlQmdfDmZvd0vRcymWSecrfGm8rzTb/c0912n1rqrw.mp4?vkey=0A9434327F854F742C34AEA63A4F5D91ECD3BD9941D4A21621691B03C74371E884E6AF55D20955207FFCE82AA75A01A55B29C753410E57BDCD9CB487C427D06C88D3DC8EEAF862862C5ACE1D009EA9AB4E9E9FD248C76EA2072BCAF06BA0F96DE76EE242119D5AAC873A6C18214552B745D194B35B1F1525CBE32AC7B90C7EAA',
      'rating': None,
      'recommend': None,
      'region': None,
      'share_count': None,
      'tag': ['敬 Mac 背後的你 - 試出可能 - Apple',
              '騰訊視頻',
              '電影',
              '電視劇',
              '綜藝',
              '新聞',
              '財經',
              '音樂',
              'MV',
              '高清',
              '視頻',
              '在線觀看'],
      'title': '敬 Mac 背後的你 - 試出可能 - Apple',
      'upload_date': None,
      'upload_ts': 1262275200,
      'vid': 'c0912n1rqrw',
      'view_count': '246304',
      'webpage_url': 'https://v.qq.com/x/page/c0912n1rqrw.html',
      'width': None}]
    """
    
  6. 測試Demo

    from aioVextractor.api import hybrid_worker
    import aiohttp
    import asyncio
    from pprint import pprint
    
    async def test(url):
        async with  aiohttp.ClientSession() as session:
            result = await hybrid_worker(
                webpage_url=url,
                session=session,
            )
            return result
    
    url = "https://www.youtube.com/playlist?list=PLs54iBUqIopDv2wRhkqArl9AEV1PU-gmc"  ## u can try any url from `TEST_CASE`
    pprint(asyncio.run(test(url=url)))
    
    
    """
    OUTPUT:
    Processing URL: https://www.youtube.com/playlist?list=PLs54iBUqIopDv2wRhkqArl9AEV1PU-gmc
    ([{'ad_link': None,
       'author': None,
       'author_attention': None,
       'author_avatar': None,
       'author_birthday': None,
       'author_description': None,
       'author_follwer_count': None,
       'author_follwing_count': None,
       'author_gender': None,
       'author_id': None,
       'author_sign': None,
       'author_url': None,
       'author_videoNum': None,
       'category': None,
       'cdn_url': None,
       'collect_count': None,
       'comment_count': None,
       'cover': 'https://i.ytimg.com/vi/61CQm2zVVk0/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLAKICJl2FlmleQsKntUd0KIeOEjZA',
       'description': None,
       'dislike_count': None,
       'download_count': None,
       'downloader': 'ytd',
       'duration': None,
       'forward_count': None,
       'from': 'youtube',
       'gender': None,
       'height': None,
       'language': None,
       'like_count': None,
       'play_addr': None,
       'playlist_url': 'https://www.youtube.com/playlist?list=PLs54iBUqIopDv2wRhkqArl9AEV1PU-gmc',
       'rating': None,
       'recommend': None,
       'region': None,
       'share_count': None,
       'tag': None,
       'title': "The Avengers Earth's Mightiest Heroes Se1 - Ep01 Breakout (Part "
                '1) - Part 01',
       'upload_date': None,
       'upload_ts': None,
       'vid': '61CQm2zVVk0',
       'view_count': None,
       'webpage_url': 'https://www.youtube.com/watch?v=61CQm2zVVk0&list=PLs54iBUqIopDv2wRhkqArl9AEV1PU-gmc&index=2&t=0s',
       'width': None},
       ...
      {'ad_link': None,
       'author': None,
       'author_attention': None,
       'author_avatar': None,
       'author_birthday': None,
       'author_description': None,
       'author_follwer_count': None,
       'author_follwing_count': None,
       'author_gender': None,
       'author_id': None,
       'author_sign': None,
       'author_url': None,
       'author_videoNum': None,
       'category': None,
       'cdn_url': None,
       'collect_count': None,
       'comment_count': None,
       'cover': 'https://i.ytimg.com/vi/PRT3FjaP71E/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLA2zBcMa68iPw6tQO5nSbKlkwFv8w',
       'description': None,
       'dislike_count': None,
       'download_count': None,
       'downloader': 'ytd',
       'duration': None,
       'forward_count': None,
       'from': 'youtube',
       'gender': None,
       'height': None,
       'language': None,
       'like_count': None,
       'play_addr': None,
       'playlist_url': 'https://www.youtube.com/playlist?list=PLs54iBUqIopDv2wRhkqArl9AEV1PU-gmc',
       'rating': None,
       'recommend': None,
       'region': None,
       'share_count': None,
       'tag': None,
       'title': "The Avengers Earth's Mightiest Heroes Se1 - Ep10 Everything Is "
                'Wonderful - Screen 04',
       'upload_date': None,
       'upload_ts': None,
       'vid': 'PRT3FjaP71E',
       'view_count': None,
       'webpage_url': 'https://www.youtube.com/watch?v=PRT3FjaP71E&list=PLs54iBUqIopDv2wRhkqArl9AEV1PU-gmc&index=101&t=0s',
       'width': None}],
     True,
     {'clickTrackingParams': 'CD0QybcCIhMI16ucw-G35QIV40L1BR0A1weh',
      'continuation': '4qmFsgI2EiRWTFBMczU0aUJVcUlvcER2MndSaGtxQXJsOUFFVjFQVS1nbWMaDmVnWlFWRHBEUjFFJTNE'})
    """
    
  7. 測試通過鏈接:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章