Scripts for conversion from sogou browser favorites to Firefox favorites

Source: Internet
Author: User
Tags html header

At the request of someone in the same office, she got the Favorites list exported by her sogou Browser: an XML file. She was about to migrate it to Firefox, but she found that it could be imported in Firefox.
Favorites are only in HTML and JSON formats (there may be more, but I have not studied it well ). I tried to export my Firefox favorites and compared
HTML files and sogou's XML files do not bother to convert them. So I opened the powergui that was not used for a long time and wrote a script using powershell to view sogou.
To the favorites files available in Firefox (HTML format ).

The following is a script:

 

######################################## ############## <Br/> # This script is used to convert the XML file of sogou favorites to the HTML file of Firefox. <br/> # you can use Firefox to import exported HTML files to favorites. <br/> # last modification date of knktc: <br/> ################################## ####################< br/> # required parameters <br/> # sogou favorites files <br/> $ sougou_xml = "" <br/> # conversion target file <br/> $ firefox_html = "" </P> <p> # Writing an HTML header <br/> "<! Doctype NETSCAPE-Bookmark-file-1> "> $ firefox_html <br/>"> $ firefox_html <br/> "<meta HTTP-EQUIV = '" Content-Type' "content = '" text/ HTML; charset = UTF-8 '">"> $ firefox_html <br/> "<title> bookmarks </title>"> $ firefox_html <br/> "> $ firefox_html <br/> # Read XML files <br/> $ xml = [XML] (get-content $ sougou_xml-encoding utf8) <br/> # calculate the number of folder-level bookmarks <br/> $ folder_count = ($ XML. main. item ). length <br/> for ($ I = 0; $ I-lt $ folder_count; $ I ++) <br/>{< br/> $ folder_flag = $ XML. main. item [$ I]. isfolder <br/> if ($ folder_flag-EQ 0) <br/>{< br/> $ website_name = $ XML. main. item [$ I]. name <br/> $ website_url = $ XML. main. item [$ I]. '# text' <br/> "<DT> <a href ="' "mce_href =" '"" + $ website_url + "'"> "+ $ website_name +" </a> ">>$ firefox_html <br/>}< br/> for ($ I = 0; $ I-lt $ folder_count; $ I ++) <br/>{< br/> $ folder_flag = $ XML. main. item [$ I]. isfolder <br/> if ($ folder_flag-EQ 1) <br/>{< br/> # extract the folder name and write the folder name to the HTML file. <br/> $ folder_name = $ XML. main. item [$ I]. name <br/> "<DT> <p>" + $ folder_name + "</p>"> $ firefox_html </P> <p> # Start to process the current folder URL content <br/> $ url_count = ($ XML. main. item [$ I]. item ). length <br/> for ($ J = 0; $ J-lt $ url_count; $ J ++) <br/>{< br/> $ website_name = $ XML. main. item [$ I]. item [$ J]. name <br/> $ website_url = $ XML. main. item [$ I]. item [$ J]. '# text' <br/> "<DT> <a href ="' "mce_href =" '"" + $ website_url + "'"> "+ $ website_name +" </a> ">>$ firefox_html <br/>}< br/> # End of script

I feel very bad about what I wrote when I was bored. It is very suitable for people who just learned powershell for a few days ...... If you want to use this script, you can assign $ sougou_xml and $ firefox_html to the desired values.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.