Comments (6)
Hey Thanks for raising the issue here. Can you share the entire code that you used to try? just the scraping part
from build_tools_to_automate_python.
Hey Thanks for raising the issue here. Can you share the entire code that you used to try? just the scraping part
def extract_news(url):
print('Extracting Hacker news Stories...')
cnt=''
cnt +=('<b>HN Top Stories:</b>\n'+'<br>'+'-'*50+'<br>')
response = requests.get(url)
content = response.content
soup = BeautifulSoup(content, 'html.parser')
for i, tag in enumerate(soup.find_all('td', attrs={'class':'title','valign':''})):
cnt += ((str(i+1)+' :: '+tag.text + "\n" + '<br>') if tag.text!='More' else '')
return (cnt)
cnt = extract_news('https://news.ycombinator.com/')
content += cnt
content += ('<br>------</br>')
content += ('<br><br>End of Message')
from build_tools_to_automate_python.
You need to indent line 9, cnt+=((str(i+1)..., otherwise the loop ends after the first iteration.
from build_tools_to_automate_python.
Thanks @ODubDubH3 for the comment. Appreciate it. I seemed to have missed this!
from build_tools_to_automate_python.
from build_tools_to_automate_python.
Thank you @ODubDubH3 I'm trying to post more Automation videos - https://www.youtube.com/playlist?list=PLpdmBGJ6ELUIDexUW-_hgz1JA86aAT7eZ
Check it out when you get time, Always up for feedback and improvements!
from build_tools_to_automate_python.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from build_tools_to_automate_python.