Revision: 68344
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 8, 2015 19:21 by xXxPizzaBreakfastxXx
Initial Code
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<string> yt_links = new List<string>();
//list of (html code <A> </A> for a link).
StreamReader sr = new StreamReader(@"F:/old-bookmarks.html");
string line = "";
while ( (line = sr.ReadLine()) != null )
{
//..
//contains youtube link?
if(line.Contains("A HREF=\"http://www.youtube.com/watch"))
{
yt_links.Add(line);
}
}
StreamWriter sw = new StreamWriter(@"F:\yt_old_bookmarks.html");
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();
}
}
}
Initial URL
Initial Description
This is a simple example to quickly and easily produce a set of links for a given site in your bookmarks from Firefox..
Initial Title
Bookmark editing (filter links)
Initial Tags
web, user
Initial Language
C#