So I want to scrape the table from this website: NCLT
I want to take this table's data in the same format including the hyperlinks and put it into an excel worksheet. I have already tried copy pasting the table but the formatting of table messes up. I want my data in a Dataframe in CSV format or Excel format.
Here's what I've tried:
url = "https://archive.nclt.gov.in/judgement-date-wise?field_bench_target_id=5372&field_search_date_value%5Bmin%5D%5Bdate%5D=01/01/19&field_search_date_value%5Bmax%5D%5Bdate%5D=01/01/21&page=0"
response = requests.get(url).text
soup = BeautifulSoup(response, 'html.parser')
part where I am facing problem.
t_r= soup.find_all('tr')
t_r[1]
gives following output:
<tr class="odd views-row-first">
<td class="views-field views-field-counter">
1 </td>
<td class="views-field views-field-field-cp-no">
CPNo.464/BB/2018 </td>
<td class="views-field views-field-field-name-of-petitioner">
M/s Shankar Subramanya bhat Vs M/s Star Cable Infomet Pvt Ltd
<br/>
A Murali, Advocate
<br/>
SPJ Legal R1-4 </td>
<td class="views-field views-field-field-final-order-date">
<span class="date-display-single" content="2020-01-16T00:00:00+05:30" datatype="xsd:dateTime" property="dc:date">16-01-2020</span> </td>
<td class="views-field views-field-field-final-orders-pdf">
<a href="https://archive.nclt.gov.in/sites/default/files/January2021/final-orders-pdf/Star%20Cable.pdf" target="_blank"><img alt="PDF icon" class="file-icon" src="modules/file/icons/application-pdf.png" title="application/pdf"/></a> Size :- 6.5 MB, Language:- English </td>
</tr>
Since I am new to BS4 I am trying to figure out on how to copy the Following from each t_r[i]:
So far in my code i am only able to gather S.no. using the following snippet:
t_r[1].td.string.replace('\n', '').strip()
I also want a similar code to obtain: CPNo.464/BB/2018 , M/s Shankar Subramanya bhat Vs M/s Star Cable Infomet Pvt Ltd, 16-01-2020, https://archive.nclt.gov.in/sites/default/files/January2021/final-orders-pdf/Star%20Cable.pdf"
For some reason, I am not being able to the same for the rest of the fields in t_r[i]. I don't understand how to progress further than this. I want extract the rest of the data as well but using the 't_r.contents' isn't working. Any help would be greatly appreciated.
How I want the output to look like This output but with just the href link in the last column instead of size and medium