如何使用src标签从网页下载视频?

时间:2019-04-21 21:55:55

标签: python parsing beautifulsoup

我想从Steam商店页面下载游戏视频。但是,每当我尝试这样做时,都会出现“'NoneType'对象不可下标”错误

这是我的代码:

<td><a href="{% url 'depot:change_container'  operation='add' pk=container.container_id fk=contents.sample_id  %}" class="badge badge-primary" role="button">add</a></td>

1 个答案:

答案 0 :(得分:0)

您可以按如下方式使用属性选择器:

def find_sentences(paragraph):
global ref_data_lists,ref_lists,sentences,ref_data_list,ref_list
end = True
# sentences = []
while end > -1:
    end = find_sentence_end(paragraph)
    if end > -1:
        sentences.append(paragraph[end:].strip())
        paragraph = paragraph[:end]
sentences.append(paragraph)
sentences.reverse()
ref_list.clear()
ref_data_list.clear()
for sentence in sentences:
    # sentence=re.sub(r'^(\[\d+\])', '', sentence)
    ref = re.search(r'^\[\d+\]', sentence, re.MULTILINE)
    ref_data = re.search(r'(\[\d+\]\s*){1,}', sentence)

    if ref:

        print(ref_list)
        ref_list.append(sentence)
    ref_lists = '\n------------------\n'.join(ref_list)

    if ref_data:


        print(ref_data_list)
        ref_data_list.append(sentence)
    ref_data_lists = '\n------------------\n'.join(ref_data_list)

print(ref_list)
print(ref_data_list)
# for refs in ref_list:
#   for ref_data in ref_data_list:
#      r=refs[:3]
#     if r in ref_data:
#        print(refs,"------------>",ref_data)

return