Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit c43a74c

Browse files
Update economictimes_scraper.py
1 parent 8bd958d commit c43a74c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎Scripts/Web_Scrappers/Economictimes_Scraper/economictimes_scraper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from bs4 import BeautifulSoup
2-
fromlxmlimport etree
2+
import defusedxml
33
import requests
44
import json
55
import datetime
@@ -38,7 +38,7 @@ def datestr_to_date(datestr):
3838
## Gets News article metadata from article url
3939
def fetchNewsArticle(url):
4040
html = requests.get(url).content
41-
root = etree.HTML(html)
41+
root = defusedxml.HTML(html)
4242
x = root.xpath("/html/body//script[@type='application/ld+json']")
4343
metadata = None ## When Article does not exists (404)
4444
if (len(x) >= 2):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /