Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8" ?>
- <!-- SharpLeech 2.x.x SiteReader Plugin -->
- <!-- Version MUST be in x.x.x.x format! -->
- <SiteReader pluginVersion="2.0.0.0" pluginAuthor="Last Word">
- <Settings>
- <SiteName>WarezScene</SiteName>
- <BaseUrl>http://www.warezscene.org</BaseUrl>
- <TopicsPerPage>20</TopicsPerPage>
- <!-- Supported type values are: IP.Board 3.x.x, IP.Board 2.x.x,
- vBulletin 4.x.x, vBulletin 3.x.x, phpBB 3.x.x, phpBB 2.x.x -->
- <Type>vBulletin 3.x.x</Type>
- <!-- If unsure choose ISO-8859-1. Except for phpBB 3 boards, they use UTF-8 by default. -->
- <DefaultEncoding>ISO-8859-1</DefaultEncoding>
- <!-- Set to true if the site uses SEO urls, otherwise false. -->
- <AllowRedirects>true</AllowRedirects>
- <UseFriendlyLinks>true</UseFriendlyLinks>
- </Settings>
- <Sections>
- <Section title="Applications" id="3" />
- <Section title="Games" id="9" />
- <Section title="Console Games" id="43" />
- <Section title="PSP Games" id="311" />
- <Section title="Movies / TV Shows" id="2" />
- <Section title="TV Shows" id="312" />
- <Section title="Music / Albums" id="18" />
- <Section title="Music Videos" id="325" />
- <Section title="Scripts, Templates, and Web Downloads" id="4" />
- <Section title="Non-Windows Downloads" id="19" />
- <Section title="Mac Applications and Games" id="236" />
- <Section title="Mobile Downloads" id="342" />
- <Section title="Adult Warez" id="238" />
- <Section title="eBooks / Tutorials" id="36" />
- <Section title="File Servers (FTP)" id="239" />
- <Section title="Guest Downloads" id="41" />
- </Sections>
- <!-- Edit this when the site requires custom parsing -->
- <Code>
- <![CDATA[
- protected override void Init()
- {
- base.Init();
- }
- public override void LoginUser(string username, string password)
- {
- base.LoginUser(username, password);
- }
- public override void LogoutUser()
- {
- base.LogoutUser();
- }
- public override string[] GetTopicUrls(string html)
- {
- return base.GetTopicUrls(html);
- }
- // vBTeam hosts the downloads on their site.
- // Quietly sneak in and grab the attachment link(s).
- public override SiteTopic GetTopic(string url)
- {
- if (!this.Type.User.IsLoggedIn) return null;
- HtmlDocument doc = new HtmlDocument();
- HttpWebRequest req;
- HttpResult result;
- req = Http.Prepare(url);
- req.Method = "GET";
- req.Referer = url;
- try
- {
- result = this.Type.AllowRedirects ? Http.HandleRedirects(Http.Request(req), false) : Http.Request(req);
- doc.LoadHtml(result.Data);
- if (result.HasError) throw result.Error;
- HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//img[@alt='Reply With Quote']");
- string link = HttpUtility.HtmlDecode(nodes[0].ParentNode.GetAttributeValue("href", String.Empty));
- nodes = doc.DocumentNode.SelectNodes("//div[@class='smallfont']");
- string title = (from n in nodes
- where n.ParentNode.InnerHtml.Contains("<!-- icon and title -->")
- select HttpUtility.HtmlDecode(n.InnerText).Trim()).ToArray()[0];
- // Grab attachments
- nodes = doc.DocumentNode.SelectNodes("//a");
- var attachments = from n in nodes
- where n.GetAttributeValue("href", String.Empty).Contains("itbux.com/attachments/")
- select n.GetAttributeValue("href", String.Empty);
- req = Http.Prepare((link.StartsWith("http:")) ? link : this.Type.BaseUrl + "/" + link);
- req.Method = "GET";
- req.Referer = url;
- result = this.Type.AllowRedirects ? Http.HandleRedirects(Http.Request(req), false) : Http.Request(req);
- doc.LoadHtml(result.Data);
- if (result.HasError) throw result.Error;
- string content = doc.DocumentNode.SelectNodes("//textarea[@name='message']")[0].InnerText;
- content = HttpUtility.HtmlDecode(content.Substring(content.IndexOf(']') + 1)).Trim();
- content = content.Substring(0, content.Length - "[/quote]".Length);
- // Add attachments...
- if (attachments.ToArray().Length > 0)
- {
- content += "\n\n[b]Download:[/b]\n[code]";
- foreach (string attachment in attachments) content += HttpUtility.HtmlDecode(attachment) + "\n";
- content += "[/code]";
- }
- return new SiteTopic(
- title.Trim(),
- content.Trim(),
- 0, 0, url
- );
- }
- catch (Exception error)
- {
- // TODO: log error...
- return null;
- }
- }
- public override SiteTopic GetTopic(int topicId)
- {
- string url = this.Type.BaseUrl + String.Format(this.Type.TopicPath, topicId);
- return this.GetTopic(url);
- }
- public override HttpWebRequest GetPage(int sectionId, int page, int siteTopicsPerPage)
- {
- return base.GetPage(sectionId, page, siteTopicsPerPage);
- }
- public override void MakeReady(int sectionId)
- {
- base.MakeReady(sectionId);
- }
- ]]>
- </Code>
- </SiteReader>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement