Coding A Simple Web Browser in Python

Поділитися
Вставка
  • Опубліковано 10 лют 2025
  • Today we build a simple web browser with a GUI in Python.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine...
    💻 The Algorithm Bible Book: www.neuralnine...
    👕 Programming Merch: www.neuralnine...
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine...
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/Neu...
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/

КОМЕНТАРІ • 143

  • @765InfuzedOfficial
    @765InfuzedOfficial Місяць тому

    The smile that hit my face when I opened my first browser was worth it. Thank you!

  • @addledanorak8297
    @addledanorak8297 3 роки тому +53

    Another great use case for this (This is what i do in my projects sometimes): You can use this for creating awesome looking UIs. Just write a simple flask app and run the two things simultaneously so that now you can use HTML/CSS for UI instead of Qt5. I personally love using HTML/CSS so i use this trick for creating complex UIs in projects. Without the buttons on the top (go back, reload etc), it just looks like a window of some usual software.

    • @robinferizi9073
      @robinferizi9073 3 роки тому +2

      But how do you get your flask app on the window

    • @addledanorak8297
      @addledanorak8297 3 роки тому +7

      7:16
      Use the setUrl function and pass in the localhost url your flask app is running on

    • @robinferizi9073
      @robinferizi9073 3 роки тому +1

      @@addledanorak8297 but how would you show other webpages? And how would you keep the url bar and whatnot there

    • @MrinmoyHaloi
      @MrinmoyHaloi 3 роки тому +2

      @@robinferizi9073 you can do that with html and js

    • @addledanorak8297
      @addledanorak8297 3 роки тому +3

      @Robin Ferizi what I meant was to use the browser as a window that can show your flask project so that u can use html and css for ui and it looks like a professional software. That's all

  • @dicember92
    @dicember92 2 роки тому +6

    Man, I need to say thanks! I crashed my head for an entire day trying to make a simple UI to stream a local server network content for a local community. I tried with socket, but I couldn't resolve my problem. Watching your video I understood that I could make a non navigable-browser with PyQt5. So a huge thanks!!

    • @Sebas0173YT
      @Sebas0173YT 2 роки тому

      help bro that said like 16 error who are by the importatipon

    • @dicember92
      @dicember92 2 роки тому +1

      @@Sebas0173YT you should check for the error and name of the library (pyqt5) on stackoverflow. I had issues with one of the methods and I had to install a separate library, but I don’t remember what it was. Something like qtweb

    • @Sebas0173YT
      @Sebas0173YT 2 роки тому

      @@dicember92 I found how but how can i install an adblocker in this browser.

  • @dany_fg
    @dany_fg 6 місяців тому +3

    this is great for django/flask/fastapi based apps, as you can create a web window for the server without the user even realizing

  • @robinferizi9073
    @robinferizi9073 3 роки тому +6

    So close to 100k, you can do it

  • @OmarHosam203
    @OmarHosam203 3 роки тому +6

    yay finally i can do something that big tech companies do

  • @MACAPOBREJUNERAYM
    @MACAPOBREJUNERAYM 4 місяці тому

    nice short and easy to understand and follow man

  • @cipherxen2
    @cipherxen2 3 роки тому +15

    This is not "coding web browser", it's just "using web browser" in your application.

    • @whereisyourhijab
      @whereisyourhijab 4 місяці тому

      Browsers basically use search engines to search and he is doing that. Making a browser doesn't mean you have to code the search engine yourself too

    • @cipherxen2
      @cipherxen2 4 місяці тому

      ​@@whereisyourhijabwhat search engine has to do with it? Do you even understand my comment.

    • @Logan_Wolf_Online
      @Logan_Wolf_Online 4 місяці тому

      @@cipherxen2 You are using lines of code to set up an interface to interact with websites. Ergo you are coding a web browser. You can use C in Windows to create a Desktop app that does the same thing, and it is still coding an GUI program that lets you browse the web, a "web browser". What, do you want him to write it from Assembly instead?

    • @cipherxen2
      @cipherxen2 4 місяці тому

      ​@@Logan_Wolf_Onlineso by your logic, if I write a program
      import MyWebBrowser
      MyWebBrowser()
      Did I create a web browser? Or just used an existing one?

  • @MrinmoyHaloi
    @MrinmoyHaloi 3 роки тому +3

    hey neuralnine. Don't use wildcard imports. Its not a good practice. It can affect the performance of the app.

  • @parthbansal2775
    @parthbansal2775 3 роки тому +12

    I wanted to know the python book that you recommend in the description, do they only involve data structures and algorithms or they involve libraries that you use to make this Fire content?
    Once again, really like your tutorial/projects on Machine learning

  • @DJ-TheGhosted
    @DJ-TheGhosted 5 місяців тому

    What software tool app did you download and use to create web browser in python?

  • @kanishkmishra1017
    @kanishkmishra1017 3 роки тому +2

    You have been always great 👍

  • @ankdo8044
    @ankdo8044 3 роки тому +3

    Oh , you using pyqt now!😲

  • @springchilli4481
    @springchilli4481 Рік тому

    Man my idle is spitting out 4 million syntax errors

  • @Dragonal_youtube
    @Dragonal_youtube 7 місяців тому

    hi i watching on your video with my web browser :D

  • @NR_5tudio
    @NR_5tudio 28 днів тому

    just a question, how we can add tabs for the browser?

  • @IzUrBoiKK
    @IzUrBoiKK 3 роки тому

    Brooooo Congo! This vid is getting views so fast!!!!!!!!

  • @souravjha2146
    @souravjha2146 3 роки тому +3

    4k to go man

  • @emperorj4783
    @emperorj4783 3 роки тому

    ?? years from now*
    Man creates internet 2.0
    Who's that? NeuralNine! :D

  • @wheelawake
    @wheelawake 3 роки тому +3

    Great video! Wonder if this can be used for a custom selenium/browser automation type application. Excited to tinker with it, thanks!

    • @Victor_Marius
      @Victor_Marius 3 роки тому

      I tried using selenium but it's painful

    • @qock1106
      @qock1106 3 роки тому

      @@Victor_Marius nah its ez ur just inexperienced

    • @Victor_Marius
      @Victor_Marius 3 роки тому

      @@qock1106 Selenium is painful because you have to keep the driver updated to the same version as the browser which can update automatically (Chrome). And some drivers won't work so easy

    • @gnsf
      @gnsf 2 роки тому

      @@Victor_Marius naaah, it's easy if you know html and stuff as well

  • @ChaosArtist
    @ChaosArtist 11 місяців тому

    Great tutorial. Thanks.

  • @subhankarchakraborty3866
    @subhankarchakraborty3866 3 роки тому +2

    This is what I searching for, thak you @nuralnine 😜

  • @ralphanthony5198
    @ralphanthony5198 Рік тому

    Great video-tutorials, amigo. You're good! And I have a question hoping you can answer: I have been trying to create an app where I can open three websites in three different QTabs. Using PyQt5 or PyQt6. But my sites have chats, and the chat doesn't load along with the website unless I use pywebview. So my question is: how can I add tabs to a window using pywebview and display a site in them, so I can select from a dropdown the site that I want to open (within the same window, not multiple windows)? Any help will be greatly appreciated! Keep up the great work, it helps more than you can imagine!

  • @If0n702
    @If0n702 2 роки тому +3

    Can you post the source code somewhere?

  • @jasondelong83
    @jasondelong83 2 роки тому

    Extremely useful, thank you. Do you have any resources on how to work with cookies on this?

    • @efeloteishe4675
      @efeloteishe4675 2 роки тому

      its based on chromium so everything is already set up

  • @g0blax171
    @g0blax171 3 роки тому +2

    After seeing your videos (which ones are really good), I was wondering if it is possible to create a UA-cam clone or Twitch clone with Python and Flask... I was trying to search the way to connect the OBS for live streaming to an specific app created on Python but no clue found on internet... maybe you know or you can help me with that question. Thanks!!

    • @micsdf7
      @micsdf7 3 роки тому +1

      There is a cool tutorial on how to create a Twitter clone in Django (Yep, not Flask). ua-cam.com/video/f1R_bykXHGE/v-deo.html . I personally didn't finish it, but it was very useful.

    • @joiverx1227
      @joiverx1227 3 роки тому

      well all the source code of twitch got leaked so if you got your hands on it you can def make a close to 100% clone

  • @RaheelJunaid
    @RaheelJunaid 3 роки тому +1

    You copying my webcam positioning xD. Just kidding of course; thanks for the helpful tutorial!

  • @ActivoApperal
    @ActivoApperal 3 роки тому +1

    what form of python are you using, my cmd line/prompt looks way different?

  • @Afkmuds
    @Afkmuds Рік тому

    can you tell me why i can write it exactly as you do an check the install on mhy pips and its just like mmm nah

  • @Lazar-vk9vw
    @Lazar-vk9vw Рік тому

    Hey, a quick question, is it possible to implement the console somehow? I want to make an app that can run JS code for you in the web browser, so, wondering if that is possible

  • @zuberkariye2299
    @zuberkariye2299 3 роки тому

    You're gonna hit 100k this for sure!!! Trust me! BTW, I came here to get it motivated!

  • @Asr_Mapping
    @Asr_Mapping Рік тому

    hey dude I did the code good but it don't work and also it has 17 errors and 2 weak warnings for some reason

  • @DGA2000
    @DGA2000 Рік тому

    I thank you for a very interesting and informative vid but for some reason it won't let me navigate to, or use an url, to get to a pdf url. Why could this be happening?

  • @ZoeyTheChicken
    @ZoeyTheChicken 2 роки тому +1

    how much storage will python take up? with PyQt5 And whatever the other one is

    • @sayori3939
      @sayori3939 2 роки тому

      Since it's only code(a LOT OF CODE) it probably shouldn't take more than 100mb but i doubt it will reach 100 mb

  • @btplayzx2438
    @btplayzx2438 2 роки тому

    can you make a tutorial on how to code a adblocker for this browser

  • @guilherme5094
    @guilherme5094 3 роки тому

    Really nice!

  • @manifestasisanubari
    @manifestasisanubari Рік тому

    Hello. How do you download files from PyQt Browser?

  • @Redlava
    @Redlava 4 місяці тому

    please make this public on github I cant figure out whats wrong with my code

  • @zanylyf
    @zanylyf 5 місяців тому

    great video

  • @VideoWithEnglishsubtitles
    @VideoWithEnglishsubtitles 2 роки тому

    thank you for guide

  • @sabungee4442
    @sabungee4442 Рік тому +3

    9:08 what is exit code -1?

    • @Epsultamma
      @Epsultamma 5 місяців тому

      The exit code is just a Boolean telling you if something went wrong. 1 means something did go wrong, and thus equates to true, and 0 means everything went as planned, and thus equates to false.
      If you are having issues with the project opening when you added the back and forward buttons implemented as it is in the video, try typing "lambda: " before the self.browser forward and back functions. It works for me.

  • @mohammadaboonajmi2927
    @mohammadaboonajmi2927 2 роки тому +1

    I click on run but nothing come up what should i do?

    • @Epsultamma
      @Epsultamma 5 місяців тому

      If you are having issues with the project opening when you added the back and forward buttons implemented as it is in the video, try typing "lambda: " before the self.browser forward and back functions. It works for me.

  • @MJ-tn8tw
    @MJ-tn8tw 3 роки тому

    Thankyou is it possible to implement WebEngine view within a page

  • @nexboygaming
    @nexboygaming 5 місяців тому

    Does this work in IDLE?

  • @kaanakdik9455
    @kaanakdik9455 2 роки тому

    The download process doesn't work when i press a downloadable link in any website. Should i add a feature to qwebengine or what must i do?

    • @kaanakdik9455
      @kaanakdik9455 2 роки тому

      I solved the problem myself again. QT does not allow to download process normally. For do it, we must use QWebEngineDownloadItem class with downloadRequest signal. It was easily to use.

  • @SaarthiProGamerYT
    @SaarthiProGamerYT 6 місяців тому

    In mine it is showing pip is not recognized. Please help.

  • @MorroTX24YT
    @MorroTX24YT 2 роки тому

    Thank you

  • @VideoWithEnglishsubtitles
    @VideoWithEnglishsubtitles 2 роки тому

    how does it work with all video formats?

  • @AbdullahAlMamun-ej4my
    @AbdullahAlMamun-ej4my 3 роки тому +1

    Well I though you are gonna make it from scratch 🤣

  • @hungry_rambler
    @hungry_rambler Рік тому

    is there a way to put it on a usb? and transfer it to a different laptop

    • @Lamin777-N
      @Lamin777-N 9 місяців тому

      If that pc has py imstalled then yes

  • @joelminecrafter2640
    @joelminecrafter2640 Рік тому

    why dosnt this code work
    from PyQt5.QtCore import QUrl
    from PyQt5.QtGui import QIcon, QKeySequence
    from PyQt5.QtWidgets import QApplication, QMainWindow, QTabWidget, QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QPushButton, QAction
    from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
    class InsecurePage(QWebEnginePage):
    def certificateError(self, error):
    return False
    class BrowserTab(QWidget):
    def __init__(self):
    super().__init__()
    self.layout = QVBoxLayout()
    self.search_box = QLineEdit()
    self.search_button = QPushButton("Search")
    self.layout.addWidget(self.search_box)
    self.layout.addWidget(self.search_button)
    self.webview = QWebEngineView()
    self.layout.addWidget(self.webview)
    self.setLayout(self.layout)
    self.search_button.clicked.connect(self.loadUrl)
    self.search_box.returnPressed.connect(self.loadUrl)
    def loadUrl(self):
    url = self.search_box.text()
    if not url.startswith("http"):
    url = "" + url
    self.webview.load(QUrl(url))
    class BrowserWindow(QMainWindow):
    def __init__(self, parent=None):
    super().__init__(parent)
    self.tabs = QTabWidget()
    self.setCentralWidget(self.tabs)
    self.tabs.setTabsClosable(True)
    self.tabs.tabCloseRequested.connect(self.closeTab)
    # Create the menu bar
    menu_bar = self.menuBar()
    file_menu = menu_bar.addMenu("&File")
    # Create a new tab action
    new_tab_action = QAction(QIcon.fromTheme("tab-new"), "New &Tab", self)
    new_tab_action.setShortcut(QKeySequence.New)
    new_tab_action.triggered.connect(self.addNewTab)
    file_menu.addAction(new_tab_action)
    # Set the initial window properties
    self.setWindowTitle("Python Browser")
    self.setGeometry(100, 100, 800, 600)
    # Add the initial tab
    self.addNewTab()
    def addNewTab(self):
    tab = BrowserTab()
    self.tabs.addTab(tab, "New Tab")
    self.tabs.setCurrentWidget(tab)
    def closeTab(self, index):
    if self.tabs.count() > 1:
    self.tabs.removeTab(index)
    if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    window = BrowserWindow()
    window.show()
    sys.exit(app.exec_())

  • @kaanakdik9455
    @kaanakdik9455 2 роки тому

    It works fine when I run the codes from within pyCharm. But after converting it to exe via pyinstaller, the exe application works but does not show the web page in the window. It waits as a blank screen. Do you have an idea for this issue?

    • @kaanakdik9455
      @kaanakdik9455 2 роки тому +1

      I solved the problem. It is necessary to use PySide2 instead of PyQt5. There is a licensing difference between them. The codes are exactly the same. Just use PySide2 instead of PyQt5 during import. But still i wonder that why PyQt5 don't show the web page. What does that have to do with PyQt5 licensing?

    • @Pwnedby
      @Pwnedby 2 роки тому +1

      @@kaanakdik9455 thanks man

    • @kaanakdik9455
      @kaanakdik9455 2 роки тому

      @@Pwnedby 👍

  • @RomaCatholica
    @RomaCatholica Рік тому

    Somehow my python still doesn't recognize PyQt5, i've uninstalled and installed it so many times and it still doesn't recognize. What should i do?

    • @TheXtremerEditor
      @TheXtremerEditor 7 місяців тому

      i tried making a python env like venv

    • @RomaCatholica
      @RomaCatholica 7 місяців тому

      @@TheXtremerEditor I fixed it already, it was a year ago hahaha I'm currently using spyder

  • @erenktw
    @erenktw 2 роки тому

    how the add videoplayer for twitch ?

  • @ixink
    @ixink 3 роки тому

    Can anybody help me to add download & history button on this project cause my college mini project similar

  • @ambientsoda106
    @ambientsoda106 2 роки тому

    Hey, can these browser access the dark web?

  • @johntheocharis573
    @johntheocharis573 3 роки тому

    When I press the run buton it doesn't run. Why?

  • @robinferizi9073
    @robinferizi9073 3 роки тому +1

    Am I able to add extensions and plugins and stuff?

    • @MrinmoyHaloi
      @MrinmoyHaloi 3 роки тому +1

      no you can't. although it uses code from chromium (chrome is based on chromium) but its modified to work better with qt. all of the google services are striped out. so i think you can't install extensions.

    • @robinferizi9073
      @robinferizi9073 3 роки тому +1

      @@MrinmoyHaloi I didn’t mean chrome extensions, I meant can I add native extensions and plugins

    • @MrinmoyHaloi
      @MrinmoyHaloi 3 роки тому +1

      @@robinferizi9073 what do you mean by native plugins

    • @robinferizi9073
      @robinferizi9073 3 роки тому +1

      @@MrinmoyHaloi I mean making my own plugins for my browser and making my own extension store instead of chrome extensions

    • @IEBqp
      @IEBqp 3 роки тому

      I would say if you are good enough you can but then i remembered you asked this question, if you were good enough you wouldnt ask it soo i am saying no

  • @clarkcodm9263
    @clarkcodm9263 3 роки тому

    can we make tabs with it?

  • @h2dw1
    @h2dw1 2 роки тому

    thanks bro

  • @emperorj4783
    @emperorj4783 3 роки тому +2

    "Simple web browser"
    1) That's not "simple"
    2) That looks like a real browser
    3) Meanwhile me struggling to install windows

  • @roshanyadav4459
    @roshanyadav4459 3 роки тому +1

    sir qtwebEngineWidgets not importing error

  • @Ноунеймбезгалочки-м7ч

    no tabs I can't login😭😭

  • @MultiDenver1988
    @MultiDenver1988 Рік тому

    anyone know if have way download file ? and upload ? with PQT 5 ?

  • @vihaankakkarvlogs6892
    @vihaankakkarvlogs6892 2 роки тому

    Very bad
    Its showing incorrect in the 7th line

  • @razor8629
    @razor8629 3 роки тому

    I am trying to create a web browser using your video. It worked good, I can connect to my Disney+ account but the issue comes when I try to play a video.
    It's seems that Dineyplus blocked access if it doesn't recognise the browser ?
    Or a library PIP is missing ?
    Could you help please ?

    • @navinross3357
      @navinross3357 Рік тому

      It's possible that Disney+ has implemented some form of browser detection to block access to their videos if the browser is not recognized. This is a common technique used by streaming services to prevent piracy and unauthorized access.
      To work around this issue, you can try spoofing your browser's user agent to make it appear as a different browser that Disney+ recognizes. You can do this by adding an HTTP header to your requests with the user agent string of a known browser.

  • @Brlitzkreig
    @Brlitzkreig Рік тому

    Flori mo bur je shqiptare. Bro are you Albanian your name means gold

  • @philtoa334
    @philtoa334 2 роки тому

    Thx

  • @mrmelon8
    @mrmelon8 Рік тому

    Do it in C 💀

  • @fatinishmam5213
    @fatinishmam5213 2 роки тому

    Please provide link of codes of your video in description. It is very helpful to get the codes in one place for coping.

  • @WeirdDev69
    @WeirdDev69 3 роки тому

    using google na ?

  • @justcoding8373
    @justcoding8373 2 роки тому

    How to add extensions ?

  • @osiris5449
    @osiris5449 2 роки тому

    Watching tutorials, I keep seeing videos which seems like the people who may be attacking me online. Go figure, I'm subscribed to them. But, I wasn't to you? I just subscribed, I'm so confused. These other YT out here be hacking their viewers? 😂

  • @arnavnaik2135
    @arnavnaik2135 3 роки тому

    cool

  • @friendlybear5924
    @friendlybear5924 3 роки тому

    Why though

  • @aarushkumar168
    @aarushkumar168 3 роки тому +1

    First!!

  • @gnsf
    @gnsf 2 роки тому

    import browser

  • @codenerd7823
    @codenerd7823 3 роки тому +1

    22second only

  • @Silly_Werewolf
    @Silly_Werewolf 2 роки тому +1

    can somebody tell me why my browser don't work?
    i cannot see the web pages
    the code is this
    from PyQt5.QtWidgets import *
    from PyQt5.QtCore import *
    from PyQt5.QtWebEngineWidgets import *
    class MyBrowser(QMainWindow):
    def __init__(self):
    self.window = QWidget()
    self.window.setWindowTitle('MyBrowser')
    self.layout = QVBoxLayout()
    self.horizontal = QHBoxLayout()
    self.url_bar = QTextEdit()
    self.url_bar.setMaximumHeight(30)
    self.go_btn = QPushButton("->")
    self.go_btn.setMinimumHeight(30)
    self.back_btn = QPushButton("«")
    self.back_btn.setMinimumHeight(30)
    self.forward_btn = QPushButton("»")
    self.forward_btn.setMinimumHeight(30)
    self.horizontal.addWidget(self.url_bar)
    self.horizontal.addWidget(self.go_btn)
    self.horizontal.addWidget(self.back_btn)
    self.horizontal.addWidget(self.forward_btn)
    self.browser = QWebEngineView()
    self.go_btn.clicked.connect(lambda: self.navigate(self.url_bar.toPlainText()))
    self.forward_btn.clicked.connect(self.browser.forward)
    self.back_btn.clicked.connect(self.browser.back)
    self.layout.addLayout(self.horizontal)
    self.layout.addWidget(self.browser)
    self.browser.setUrl(QUrl("google.com"))
    self.window.setLayout(self.layout)
    self.window.show()
    def navigate(self, url):
    if not url.startswith("http"):
    url = "" + url
    self.url_bar.setText(url)
    self.browser.setUrl(QUrl(url))
    app = QApplication([])
    window = MyBrowser()
    app.exec_()

  • @butterbean_v
    @butterbean_v Рік тому

    pls give me the code im to bord to do it