Python Convert HTML into JSON

Closed Posted 6 years ago Paid on delivery
Closed

I need an expert in python and who knows how to use Beautiful Soup Library to parse HTML tags. These are the rules

1. The HTML tags will start with any of the following <p>, <ol> or <ul>

2. The content of the HTML when any of step 1 tags is found will contain only the following tags: <em>, <strong> or <span style="text-decoration:underline">

3. Map step two tags into the following: <strong> will be this item {"bold":True} in a json, <em> will {"italics":True} in the json and <span style="text-decoration:underline"> will be {"decoration":"underline"}

4. Any text found would be {"text": "this is the text"} in the json

---- EXAMPLE -----

Let say l have the html below: By using this:

soup = Soup("THIS IS THE WHOLE HTML", "[login to view URL]")

allTags = [tag for tag in soup.find_all(recursive=False)]

[<p>The name is not mine it is for the people<span style="text-decoration: underline;"><em><strong>stephen</strong></em></span><em><strong> how can</strong>name </em><strong>good</strong> <em>his name <span style="text-decoration: underline;">moneuet</span>please </em><span style="text-decoration: underline;"><strong>forever</strong></span><em>tomorrow<strong>USA</strong></em></p>, <p>2</p>, <p><strong>moment</strong><em>Africa</em> <em>China</em> <span style="text-decoration: underline;">home</span> <em>thomas</em> <strong>nothing</strong></p>, <ol><li>first item</li><li><em><span style="text-decoration: underline;"><strong>second item</strong></span></em></li>

</ol>]

-- ANSWER ---

First Array element would be processed into this JSON:

{"text": ["The name is not mine it is for the people", {"text": "stephen", "decoration::"underline", "bold":True, "italics": True}, {"text":"how", "bold":True, "italics": True}, {"text":"name", "italics": True}, {"text":"good", "bold": True}, {"text":"his name", "italics": True}, {"text":"moneuet, "decoration": "underline"},{"text":"please ", "italics": True},{"text": "forever", "decoration::"underline", "bold":True},{"text":"tomorrow", "italics": True},{"text":"USA", "bold": True, "italics": True}

Second Array element would be processed into this JSON:

{"text" "2"}

Third Array element would be processed into this JSON:

{"text": [{"text":"moment", "bold": True},{"text":"Africa", "italics": True"},{"text":"China", "italics": True},{"text":"home", "decoration": "underline"},{"text":"thomas", "italics": True},{"text":"nothing", "bold": True}]

}

The fourth Array element would be processed into this JSON:

{"ol": ["first item", {"text":"second item","decoration": "underline", "italics": True, "bold": True, "]

}

** So a function the will return a JSON with the above processed content.

CSS HTML JSON Python Web Scraping

Project ID: #15281044

About the project

39 proposals Remote project Active 6 years ago

39 freelancers are bidding on average $32/hour for this job

Vlzinch

Hi,flexpeace! I work with all kinds of websacrapers for last 7 years, and bs4 is one of my main tools for html parsing. I will load html response to bs4, search for tags, create dictionary based on it, and then du More

$37 USD / hour
(63 Reviews)
8.0
lkhelladi

hello, I'd be glad to develop the html-python conversion script for you. looking forward to chat with you soon for more details. Best regards.

$25 USD / hour
(198 Reviews)
7.6
contriverz

Hi there , Hope you doing great !!! Your given requirements review out very well and its should be performed out accordingly with topmost skills. My $kype contriverz1988 I am a full stack developer and havi More

$25 USD / hour
(109 Reviews)
7.7
kishanlalyadav

VERY EASY WORK FOR ME !!! HI SIR I M 100% CONFIDENT FOR THIS PROJECT AWARD ME RIGHT NOW!!! I am ready to start this immediately. I am extremely eager and ready to go. I am all of the following; attentive, detailed, More

$48 USD / hour
(349 Reviews)
7.1
mike199

Hi, I’m a Web Designer/Developer from the UK. My name is Mike. Your project description sounds interesting to me and I do have skills & experience that are required to complete this project. Let's have a quick chat whe More

$41 USD / hour
(34 Reviews)
6.8
prayastechnology

A proposal has not yet been provided

$27 USD / hour
(224 Reviews)
7.0
pkbsdmp

I am a python developer I am a python developer having 6 + experience in IT industry. I am expert in: Django and Flask and REST API application development CSS, HTML, HTML5, Javascript, JQuery Database Program More

$41 USD / hour
(102 Reviews)
6.6
acshovon

Hi there, I am very interested to do your assignment. I have done many projects in Python. And I have done scraping with beautiful soup. Your project seems really interesting. Please feel free to join me on chat to dis More

$50 USD / hour
(27 Reviews)
6.1
furqanorpiv

Hi, I am FURKAN a CERTIFIED CSS, HTML, JSON, Python, Web Scraping EXPERT . I would love to provide you Quality data by using Beautiful Soup Library to parse HTML tags as per your requirements. I can complete More

$25 USD / hour
(46 Reviews)
6.4
ieota

Dear Client, Thanks for your job post over Freelancer. I review your shared requirement and applying for this job just because of my previous vast amount of experience and now I would like to discuss your requiremen More

$27 USD / hour
(58 Reviews)
6.0
sgatich

Hi. I'm a programmer from Russia with strong skills in Python. You can see the full list of my skills on my profile page. I'm also good in web-scraping, browser automation and data extraction. I use Grab, Requests, Sel More

$27 USD / hour
(17 Reviews)
5.6
dvcontact

Hi, If you are looking for a professional and reliable Python expert with proficiency in web scraping to use Beautiful Soup Library and parse HTML tags, I'm your ideal candidate. I'm highly experienced in data mini More

$25 USD / hour
(9 Reviews)
5.2
omniscient04

Hi, Greetings of the Day! As we are a team of 20+ professionals for IT Services like- Website Designing and Development, SEO and SMO, Graphic Designing services. We can offer you our several years of experience in W More

$25 USD / hour
(20 Reviews)
4.7
Bhawandtu

I have 2+ years of working experience in python and I know beautifulSoup. I have done projects on that. looking forward for a positive response from you.

$25 USD / hour
(31 Reviews)
4.2
abhilashrana01

I have 3+ years of experience with Website Design and Development with php, WordPress, Wix, Magneto, Shopify, php based cms, Bootstrap, HTML, CSS, asp.net. I can provide my services in Php and database based websi More

$27 USD / hour
(16 Reviews)
4.1
rty567

have a lot of experience with such tasks you can find more details here: www_upwork_com/freelancers/~01f6eb0c335e3b2045 (replace _ with .)

$27 USD / hour
(3 Reviews)
3.3
chiragshah1312

A proposal has not yet been provided

$25 USD / hour
(1 Review)
1.3
rishianand001

I have worked on beautifulsoup. I can convert html to Kindle book. I can parse any data of html using beautifulsoup...! thanks

$27 USD / hour
(1 Review)
0.4
Shaarawy

Hi, I read your requirements and I worked on it, and I have the script almost finished, please text me and I will send you a screenshot of the results, if you are satisfied with the results, let's do the job. below is More

$25 USD / hour
(0 Reviews)
0.0
patelsagar101094

I am currently working as a python developer in one of MNC I.T. company of Ahmedabad. I have 1 year 4 months of experience. I have worked in Python, Django, Python-pandas, Web scrapping, python-numpy, python-scipy, Res More

$27 USD / hour
(0 Reviews)
0.0