00001
00002
00003
00004
00005
00006 #if !defined(AFX_VMSVIDEOSITEHTMLCODEPARSER_H__36077242_C9A7_4188_8F8D_CFE99AF921C2__INCLUDED_)
00007 #define AFX_VMSVIDEOSITEHTMLCODEPARSER_H__36077242_C9A7_4188_8F8D_CFE99AF921C2__INCLUDED_
00008
00009 #if _MSC_VER > 1000
00010 #pragma once
00011 #endif
00012
00013 class vmsVideoSiteHtmlCodeParser
00014 {
00015 public:
00016 BOOL Parse_Further (LPCSTR pszSite, LPCSTR pszHtml);
00017 BOOL get_IsVideoUrlDirectLink();
00018 BOOL Parse_GoogleVideo (LPCSTR pszHtml);
00019 static BOOL IsSiteSupported (LPCSTR pszHost);
00020 LPCSTR get_VideoType();
00021 LPCSTR get_VideoUrl();
00022 LPCSTR get_VideoTitle();
00023 BOOL Parse (LPCSTR pszSite, LPCSTR pszHtml);
00024
00025 static int GetSupportedSiteIndex (LPCSTR pszSite)
00026 {
00027
00028 #define register_site_with_subdomains(s,n)\
00029 if (stricmp (pszSite, ##s) == 0)\
00030 return n;\
00031 if (lstrlen (pszSite) > lstrlen ("."##s) && \
00032 strnicmp (pszSite + lstrlen (pszSite) - lstrlen ("."##s), "."##s, lstrlen ("."##s)) == 0)\
00033 return n;
00034
00035 if (strnicmp (pszSite, "www.", 4) == 0)
00036 pszSite += 4;
00037
00038 if (stricmp (pszSite, "youtube.com") == 0)
00039 return 0;
00040
00041 if (strnicmp (pszSite, "video.google.", 13) == 0)
00042 return 1;
00043
00044 register_site_with_subdomains ("livedigital.com", 2);
00045
00046 register_site_with_subdomains ("myspace.com", 3);
00047
00048 if (stricmp (pszSite, "sharkle.com") == 0)
00049 return 4;
00050
00051 if (stricmp (pszSite, "blennus.com") == 0)
00052 return 5;
00053
00054 if (stricmp (pszSite, "dailymotion.com") == 0)
00055 return 6;
00056
00057 if (stricmp (pszSite, "grouper.com") == 0)
00058 return 7;
00059
00060 return -1;
00061 }
00062
00063 vmsVideoSiteHtmlCodeParser();
00064 virtual ~vmsVideoSiteHtmlCodeParser();
00065
00066 protected:
00067 static fsString ExtractValue (LPSTR &psz);
00068 BOOL Parse_Grouper (LPCSTR pszHtml);
00069 BOOL Parse_DailyMotion (LPCSTR pszHtml);
00070 BOOL Parse_Blennus (LPCSTR pszHtml);
00071 BOOL Parse_Sharkle (LPCSTR pszHtml);
00072 BOOL Parse_Further_MySpace (LPCSTR pszHtml);
00073 BOOL Parse_MySpace (LPCSTR pszHtml);
00074 BOOL Parse_Further_LiveDigital (LPCSTR pszTxt);
00075 BOOL Parse_LiveDigital (LPCSTR pszHtml);
00076 BOOL m_bDirectLink;
00077 BOOL Parse_Youtube_RootPage (LPCSTR pszHtml);
00078 fsString m_strVideoTitle, m_strVideoUrl, m_strVideoType;
00079 BOOL Parse_Youtube (LPCSTR pszHtml);
00080 };
00081
00082 #endif