Click here to Skip to main content
14,870,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I tried to get the contents of script tags using python. This is code:
Python
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re

url = urlopen("https://www.wikipedia.org/")

soup = BeautifulSoup(url, 'html.parser')
first_link = soup.script
print(first_link.find_all_next(string=True))

and get the contents of script tags from the code.
Now I want to save the output to a javascript file format. How can I save the output to a javascript file format?

What I have tried:

I have tried to find information about it, but I did not get it.
Posted
Updated 21-Mar-21 23:13pm

1 solution

I already gave you a suggestion for this at How to get contents of the script tags from a page and save it to a javascript file format using Python[^]. Please do not repost the same question.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900