Opening Websites with Python Tutorial - The Webbrowser Module

Поделиться
HTML-код
  • Опубликовано: 15 янв 2025

Комментарии • 31

  • @kasineva9983
    @kasineva9983 3 года назад +5

    its so simple but i can see it being so useful

  •  2 года назад +2

    Is there any way to do the same thing in golang?

    • @TMQuest
      @TMQuest  2 года назад

      Probably yes, but I am unfortunately not that familiar with golang :S

  • @xtzewka4107
    @xtzewka4107 Год назад +1

    What if I want to open a URL and after let's say 10 seconds I want to open another one? How can I do this?

    • @TMQuest
      @TMQuest  Год назад

      Hi! You can use the sleep function in the time module to pause the execution of a program for 10 seconds. You can do this between two different calls to the webbrowser module in a script. For more information about how to use the sleep function, you can check out: www.programiz.com/python-programming/time/sleep

    • @xtzewka4107
      @xtzewka4107 Год назад

      @@TMQuest Perfect! Thank you very much

  • @KhalilYasser
    @KhalilYasser 3 года назад +2

    Cool, my bro. Thanks a lot.

  • @vivekkavthankar5238
    @vivekkavthankar5238 Год назад +1

    can we open pdf that store in directory using webbrowser

    • @TMQuest
      @TMQuest  Год назад +1

      Hi. You can open any link with the webbrowser model, so if you have a PDF shared on a public URL, then this is possible. If you are thinking about opening a PDF file that you have locally on your computer, then this is not possible with the webbrowser module.

    • @vivekkavthankar5238
      @vivekkavthankar5238 Год назад

      @@TMQuest thank u for ur reply

  • @dineshgautam7027
    @dineshgautam7027 3 года назад +1

    Thanks bro....

  • @ThrillDaWill
    @ThrillDaWill 3 года назад +1

    Is is possbile to just simply get a line of text using this module? for instance the view count of this video and print it as a string? Or would you need something like selenium/requests

    • @TMQuest
      @TMQuest  3 года назад

      I think e.g. requests would be a better approach for this :)

  • @MJ-tn8tw
    @MJ-tn8tw 3 года назад +1

    Is it possible to add in a layout while using say frameworl like pyqt

    • @TMQuest
      @TMQuest  3 года назад +1

      That should be possible :)

  • @rare5x
    @rare5x 3 года назад +1

    thanks

  • @voidlessguy
    @voidlessguy 2 года назад +2

    How do you close it man, please help me how tf do you close it??????

    • @TMQuest
      @TMQuest  2 года назад +2

      You can not close the website with the web-browser module, unfortunately.

    • @pyguy1688
      @pyguy1688 2 года назад

      import pyautogui as py
      py.hotkey("ctrl","w")
      what you are doing here is performing chrome tab closing shortcut programatically
      I'm interested in automation stuff and came across this...this might help you

    • @voidlessguy
      @voidlessguy 2 года назад

      @@pyguy1688 thanks, but you are Little too late lol, inlm using the keyboard library to do that btw, recommend for writing words, using hotkeys and f (f1, f2, f3, f4,f5...) keys

  • @ashrithasajjan9989
    @ashrithasajjan9989 3 года назад +1

    Is it possible to run the url in background whenever it is called in code

    • @TMQuest
      @TMQuest  3 года назад

      Hi. As far as I know, this is unfortunately not possible in webbroser :(

  • @nanas928
    @nanas928 3 года назад +1

    What's the difference from using the selenium module?

    • @TMQuest
      @TMQuest  3 года назад +3

      Selenium can do a lot more than the webbrowser module. On the other hand, the webbrowser module works for simple stuff and does not require an external package download :)

  • @chaitanyaasole3493
    @chaitanyaasole3493 3 года назад +1

    Sir basically I want to open RUclips through Brave browser but all videos on RUclips are showinghow to open through web browser pls help......

    • @TMQuest
      @TMQuest  3 года назад

      Hi Chaitanya,
      As far as I understand the Brave browser is simply a browser with added privacy features. There is a function in the web-browser library called register (see the docs docs.python.org/3/library/webbrowser.html) where you can register other browsers than the most standard ones. Hopefully this sets you on the right track :)

    • @Ice-on7xs
      @Ice-on7xs 2 года назад

      Or set brave to your default browser

  • @genius1320
    @genius1320 2 года назад

    Is there a way to send this to someone, so it will do it to them? Been thinking of pranking some friends :)

    • @TMQuest
      @TMQuest  2 года назад

      Then you would have to send the Python file to them and ask them to open it, which kind of ruins the fun maybe :)

    • @LambdaCreates
      @LambdaCreates Год назад

      they would need to have python installed, and then you need to somehow convince them to press the run button... which would make them suspicious.
      OR, you could try converting the file into a .exe , and then make a shortcut of it, hide the original .exe somewhere, and edit the shortcut to make it look normal.

    • @LambdaCreates
      @LambdaCreates Год назад

      I don't know why would you go to such extremes just to prank a friend that may not work, but I don't care, go prank if you want.