/ Published in: C#
This is a simple example to quickly and easily produce a set of links for a given site in your bookmarks from Firefox..
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HtmlParse { class Program { static void Main(string[] args) { //list of (html code <A> </A> for a link). string line = ""; while ( (line = sr.ReadLine()) != null ) { //.. //contains youtube link? if(line.Contains("A HREF=\"http://www.youtube.com/watch")) { yt_links.Add(line); } } sw.WriteLine("<!DOCTYPE NETSCAPE-Bookmark-file-1>" + "<!-- This is an automatically generated file." + " It will be read and overwritten." + "DO NOT EDIT! -->" + "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">" + "<TITLE>Bookmarks</TITLE>" + "<H1>Bookmarks Menu</H1>" + "<DL><p>"); foreach(string link in yt_links) { sw.WriteLine(link); } sw.WriteLine("</DL><p>" + " </DL><p>" + "</DL><p>" ); sw.Flush(); sw.Close(); } } }