mirror of
https://github.com/Lerking/web-scraping-python.git
synced 2025-07-21 19:11:04 +02:00
1st example done. /JL
This commit is contained in:
34
README.md
34
README.md
@@ -1,30 +1,30 @@
|
||||
# Python repo template
|
||||
[](https://GitHub.com/Lerking/python-repo-template/forks/)
|
||||
[](https://GitHub.com/Lerking/python-repo-template/stargazers/)
|
||||
[](https://GitHub.com/Lerking/python-repo-template/watchers/)
|
||||
# Python web scraping examples
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/forks/)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/stargazers/)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/watchers/)
|
||||
|
||||
[](https://www.python.org/)
|
||||
|
||||
[](https://github.com/Lerking/python-repo-template)
|
||||
[](https://github.com/Lerking/web-scraping-python)
|
||||
|
||||
[](https://GitHub.com/Lerking/python-repo-template.github.io/graphs/commit-activity)
|
||||
[](https://GitHub.com/Lerking/python-repo-template/graphs/contributors/)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python.github.io/graphs/commit-activity)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/graphs/contributors/)
|
||||
|
||||
[]()
|
||||
[]()
|
||||
|
||||
[](https://GitHub.com/Lerking/python-repo-template/issues/)
|
||||
[](https://GitHub.com/Lerking/python-repo-template/issues?q=is%3Aissue+is%3Aclosed)
|
||||
[](http://isitmaintained.com/project/Lerking/python-repo-template "Percentage of issues still open")
|
||||
[](http://isitmaintained.com/project/Lerking/python-repo-template "Average time to resolve an issue")
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/issues/)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/issues?q=is%3Aissue+is%3Aclosed)
|
||||
[](http://isitmaintained.com/project/Lerking/web-scraping-python "Percentage of issues still open")
|
||||
[](http://isitmaintained.com/project/Lerking/web-scraping-python "Average time to resolve an issue")
|
||||
|
||||
[](https://GitHub.com/Lerking/python-repo-template/pull)
|
||||
[](https://GitHub.com/Lerking/python-repo-template/pull)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/pull)
|
||||
[](https://GitHub.com/Lerking/web-scraping-python/pull)
|
||||
|
||||
Coding time for this reposotory.</br>
|
||||
[](https://wakatime.com/badge/user/d43f2852-fd6f-45b4-b713-558ad18204d4/project/dcf411f9-6d3e-4b14-9290-5ed419cf4012)
|
||||
[](https://wakatime.com/badge/user/d43f2852-fd6f-45b4-b713-558ad18204d4/project/6b4d8af5-fd7e-4935-8116-60b9b13b44e3)
|
||||
|
||||
See the wiki for usage and examples.
|
||||
[python-repo-template wiki page](https://github.com/Lerking/python-repo-template/wiki)
|
||||
[web-scraping-python wiki page](https://github.com/Lerking/web-scraping-python/wiki)
|
||||
|
||||
Visitors since repo creation.</br>
|
||||

|
||||

|
19
mechanicalsoup_example.py
Normal file
19
mechanicalsoup_example.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import mechanicalsoup
|
||||
|
||||
def main():
|
||||
browser = mechanicalsoup.StatefulBrowser()
|
||||
browser.open("https://www.sas.dk/book/flights/?search=RT_CPH-NYC-20230521-20230528_a1c0i0y0&view=upsell&bookingFlow=points&sortBy=rec,rec&filterBy=all,all&out_class=BUSINESS&out_sub_class=SAS%20BUSINESS%20PRO&out_flight_number=SK1462,SK907")
|
||||
|
||||
#offers = browser.page.find('td', class_='slide-plus up-grid-prods flight-products')
|
||||
#offers = browser.page.find_all('span', class_='fareprice-ubc')
|
||||
offers = browser.page.find_all('link')
|
||||
print(browser.get_url())
|
||||
print(browser.get_current_page().title.text)
|
||||
#print(browser.page)
|
||||
print(offers)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
'''
|
||||
<td flight-products="" tabindex="0" class="slide-plus up-grid-prods flight-products" aria-expanded="false"><div class="fareprice-parent fare-class-and-price-container"><span>Plus</span><!----><!----><!----><span aria-hidden="true" class="fareprice-ubc"><!----><p aria-hidden="true" class="discounted-point strike margin-auto mobilepoints max-digits">352 926 <span class="desktop-only">p</span></p></span><!----><!----><!----><!----><span role="presentation" class="sr-only"><!----><!----><span>PLUS Class fare: 352 926 <span class="points-units"> p</span><!----></span><!----><!----><!----><!----></span><!----><!----></div></td>
|
||||
'''
|
Reference in New Issue
Block a user