谷歌播客Google PodCasts解析脚本

解析某个频道,全部的结果


import json
import requests



feed_url = 'https://podcasts.google.com/feed/aHR0cHM6Ly93d3cueGltYWxheWEuY29tL2FsYnVtLzQwNDc3NDU0LnhtbA?sa=X&ved=0CNwBEI7OAigIahcKEwjgyKrX5Or-AhUAAAAAHQAAAAAQAQ'


def get_item_from_feed(url):
    out_item_list = []
    
    html = requests.get(url).text
    #with open('1.html', 'w') as f2:
    #    f2.write(html)
    for line in html.split('\n'):
        if 'AF_initDataCallback(' in line:
            blocks = line.split("AF_initDataCallback(")
            #print(blocks)
            assert ');' in blocks[1]
            block = blocks[1].split(");")[0]
            #print(block)

            #with open('1.js', 'w') as f3:
            #    f3.write(block)

            assert 'data:' in block
            assert ', sideChannel:' in block
            list

你可能感兴趣的:(python,开发语言)