Using Python for web scraping [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need to use a specific website (Translates English to my language) in my python code , and also I don't wanna use googletrans in python , it's huge load of data , so I need to use python for doing it fast , Is there any references or any title than I can read about it ? or any doc in python ?
thanks

You might want to consider using selenium or BeautifulSoup for interacting with a website or web scraping, but if you simply want to open a website you could use the webbrowser module.
import webbrowser
Google = 'https://www.google.com/?safe=active&safe=active'
webbrowser.open(Google)
Here are some links to selenium and BeautifulSoup
https://pythonspot.com/selenium-webdriver/
https://realpython.com/beautiful-soup-web-scraper-python/
Hope this helps.

Related

How do I retrieve the information thats in the chrome "Source" tab with python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
For example when you go into chrome and open a website, then go to the devtools and open up the sources tab, how would i get basically everything that is in there myself with python? Like download it with python?
There are a few popular ways to interact with web content in Python, like controlling the browser with automation, for example with selenium. This will allow you to click and extract elements from a webpage. See this example.
An alternative would be to use a library like beautifulsoup to request the webpage and parse it within your Python script. This is usually the preferred method if you don't want the dependency of an actual browser (like in headless environments). More info in the official docs.

HTML - How to scrape not visible elements using python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm using beautiful soup to scrape a webpages.
I am trying to scrape data from this https://painel-covid19.saude.ma.gov.br/vacinas. But the problem is I am getting the tags in outputs empty. In the Inspect Element I can see the data, but in page source not. You can see the code is hidden in . How can I retrieve it using python? Someone can help me?
The issue isn't "not visible". The issue is that the data is being filled in by Javascript code. You won't see the data unless you are executing the Javascript on the page. You can do that with the selenium package, which runs a copy of Chrome to do the rendering.

How would i access the object's of a website through python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Okay, as far as i know those "Objects" are only accessible through console but if it's accessible through the console why wouldn't it be accessible through python? I haven't tried anything yet because i have literal NO idea of what could i do..... Any help would be appreciated, is it possible to get the object through requests? Also i would appreciate the name that those "Objects" of the websites are called :D Thanks.
You can checkout selenium python
it has methods for the execution of scripts and finding DOM elements
driver.execute_script("some javascript code here");
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("www.google.co.in")
driver.execute_script("document.getElementsByXpath('//input[#name='q']')
Another method would be to Use beautifulsoup(BS4)
also, you can use scrappy. it's quite powerful but has a major style that needs to be followed and less freedom.

How to search for links in a given page with Bash, or Python or any other popular scripts [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Given a http/https page, I would like to search for some links on that page, anyone knows how to achieve this goal with Bash, Python or any other popular script languages?
Try this in python. It will print all tags with a link:
import requests
from bs4 import BeautifulSoup as soup
print(soup(requests.get('Your link').content).find_all('a', href=True'))
You should use Beautiful Soup. It's an html parser library in python. You'll look for <a> tags and grab the inner content.

How to navigate a webpage with python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I was made a python script for bruteforce (pen test) but before the bruteforce start, I need to go through some links clicking and login, so I want to do those stuff with python. Basically when I start that script it should login and click some links then start the bruteforce.
so, is there any way I can make my python script to do those basic stuff for me?
You might want to check these:
mechanize
Selenium
Spidermonkey
webkit
These tools will help you to emulate browser via script.

Categories