0

I have a JSON response that looks like this:

{"wynik":["\n\t\t<div class=\"col-lg-3 col-md-3 col-sm-6 mb50\">\n\t\t\t<div class=\"item\">\n\t\t\t<div class=\"movie-box-3 movie-box-search\">\n\t\t\t\t<div class=\"listing-container\">\n\t\t\t\t<a href=\"\/film2\/Anakondy.Polowanie.Na.Krwawa.Orchidee\" title=\"Anakondy: Polowanie na Krwaw\u0105 Orchide\u0119\">\n\n\t\t\t\t\t<!-- Movie List Image -->\n\t\t\t\t\t<div class=\"listing-image\">\n\t\t\t\t\t\t<!-- Image -->\n\t\t\t\t\t\t<img src=\"https:\/\/ssl-gfx.filmweb.pl\/po\/42\/50\/104250\/7128789.6.jpg\" alt=\"\" \/>\n\t\t\t\t\t\t<div class=\"movie-details-3\">\n\t\t\t\t\t\t\t<h2 class=\"title\">Anakondy: Polowanie na Krwaw\u0105 Orchide\u0119<\/h2>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<!-- Movie List Content -->\n\t\t\t\t\t<div class=\"listing-content\">\n\t\t\t\t\t\t<div class=\"inner text-center\">\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tHorror, Przygodowy\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<!-- Rating -->

How i can parse it to normal html in python to parse it like that on site?:

<div class="col-lg-3 col-md-3 col-sm-6 mb50">
            <div class="item">
            <div class="movie-box-3 movie-box-search">
                <div class="listing-container">
                <a href="/film2/Anakondy.Polowanie.Na.Krwawa.Orchidee" title="Anakondy: Polowanie na Krwawą Orchideę">

                    <!-- Movie List Image -->
                    <div class="listing-image">
                        <!-- Image -->
                        <img src="https://ssl-gfx.filmweb.pl/po/42/50/104250/7128789.6.jpg" alt="" class=" b-error">
                        <div class="movie-details-3">
                            <h2 class="title">Anakondy: Polowanie na Krwawą Orchideę</h2>
                        </div>
                    </div>

                    <!-- Movie List Content -->
                    </a><div class="listing-content"><a href="/film2/Anakondy.Polowanie.Na.Krwawa.Orchidee" title="Anakondy: Polowanie na Krwawą Orchideę">
                        </a><div class="inner text-center"><a href="/film2/Anakondy.Polowanie.Na.Krwawa.Orchidee" title="Anakondy: Polowanie na Krwawą Orchideę">

                            Horror, Przygodowy
Adelin
  • 7,809
  • 5
  • 37
  • 65
Myster
  • 29
  • 6
  • How do you use that data? Some of its content (like \n,\t) are automatically taken care of (parsed), and the other might not matter anyway – Adelin Feb 12 '19 at 09:30
  • May I know for what reason you wanna parse the HTML data the way you have mentioned? – bumblebee Feb 12 '19 at 09:33
  • Thanks for answer. I wanna make parser to get title, and link of video from the site. I have code to parse, but working only for main page (load only 12 videos from category) because for more videos i need to click "Pokaż więcej" and here is problem. In other post one man wrote me to use that api, so i trying ;) Here is site: https://filmy.plus/kategoria/Horror , here is API: https://filmy.plus/jquery_kategorie_pokaz_wiecej.php?kategoria=Horror&strona=1 – Myster Feb 12 '19 at 09:41
  • And here is my working code for 12 videos. I need to get names from all videos from category, not only 12```url = 'https://filmy.plus/kategoria/Horror' response = get(url) #print(response.text[:6000]) html_soup = BeautifulSoup(response.text, 'lxml') type(html_soup) movie_containers = html_soup.find_all('div', class_ = 'movie-box-3 movie-box-search') print(url, "\nLiczba Filmów: ", len(movie_containers),"\n") for i in range(0,len(movie_containers)): first_movie = movie_containers[i] print(first_movie.a.h2.text) print('https://filmy.plus'+first_movie.a['href']+'\n') ``` – Myster Feb 12 '19 at 09:42
  • do you have control of the API? if not you might need to [use it like a DOM element](https://stackoverflow.com/questions/2782097/python-is-there-a-built-in-package-to-parse-html-into-dom) – Adelin Feb 12 '19 at 09:49
  • Can i get some examples for use to load more videos? – Myster Feb 12 '19 at 13:03

1 Answers1

0

Ok, another way )

just use print