From 043f8a0b1a77f7a3a2db43fa6432fc624976003c Mon Sep 17 00:00:00 2001 From: VerlaCBlack Date: Tue, 3 Feb 2015 17:32:09 +0530 Subject: [PATCH] initial commit --- Facebook Scraper.sln | 20 +++ Facebook Scraper/Form1.Designer.cs | 72 +++++++++++ Facebook Scraper/Form1.cs | 105 +++++++++++++++ Facebook Scraper/Form1.resx | 120 ++++++++++++++++++ Facebook Scraper/ImageCrawler.csproj | 93 ++++++++++++++ Facebook Scraper/Program.cs | 21 +++ Facebook Scraper/Properties/AssemblyInfo.cs | 36 ++++++ .../Properties/Resources.Designer.cs | 71 +++++++++++ Facebook Scraper/Properties/Resources.resx | 117 +++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ Facebook Scraper/Properties/Settings.settings | 7 + 11 files changed, 692 insertions(+) create mode 100644 Facebook Scraper.sln create mode 100644 Facebook Scraper/Form1.Designer.cs create mode 100644 Facebook Scraper/Form1.cs create mode 100644 Facebook Scraper/Form1.resx create mode 100644 Facebook Scraper/ImageCrawler.csproj create mode 100644 Facebook Scraper/Program.cs create mode 100644 Facebook Scraper/Properties/AssemblyInfo.cs create mode 100644 Facebook Scraper/Properties/Resources.Designer.cs create mode 100644 Facebook Scraper/Properties/Resources.resx create mode 100644 Facebook Scraper/Properties/Settings.Designer.cs create mode 100644 Facebook Scraper/Properties/Settings.settings diff --git a/Facebook Scraper.sln b/Facebook Scraper.sln new file mode 100644 index 0000000..af68f5f --- /dev/null +++ b/Facebook Scraper.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCrawler", "ImageCrawler\ImageCrawler.csproj", "{FC8B58A9-FB29-4329-9C5C-2303E516B132}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FC8B58A9-FB29-4329-9C5C-2303E516B132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC8B58A9-FB29-4329-9C5C-2303E516B132}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC8B58A9-FB29-4329-9C5C-2303E516B132}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC8B58A9-FB29-4329-9C5C-2303E516B132}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Facebook Scraper/Form1.Designer.cs b/Facebook Scraper/Form1.Designer.cs new file mode 100644 index 0000000..31c4ffb --- /dev/null +++ b/Facebook Scraper/Form1.Designer.cs @@ -0,0 +1,72 @@ +namespace ImageCrawler +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(98, 161); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(64, 80); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 1; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(322, 262); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + } +} + diff --git a/Facebook Scraper/Form1.cs b/Facebook Scraper/Form1.cs new file mode 100644 index 0000000..97aa937 --- /dev/null +++ b/Facebook Scraper/Form1.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using GlobusLib; +using System.Net; +using System.IO; +using System.Drawing.Imaging; + + +namespace ImageCrawler +{ + public partial class Form1 : Form + { + GlobusHttpHelper httpHelper; + GlobusRegex globusRegex; + + List lst = new List(); + List lst1 = new List(); + + public Form1() + { + httpHelper = new GlobusHttpHelper(); + globusRegex = new GlobusRegex(); + InitializeComponent(); + } + private string imageUrl; + private Bitmap bitmap; + public Form1(string imageUrl) + { + this.imageUrl = "http://lurieunaward.com/1st_Alfredo_Sabat_cartoon2006.jpg"; + } + public void Download() { + try { + WebClient client = new WebClient(); + Stream stream = client.OpenRead("http://lurieunaward.com/1st_Alfredo_Sabat_cartoon2006.jpg"); + bitmap = new Bitmap(stream); + stream.Flush(); + stream.Close(); + } + catch (Exception e) { + Console.WriteLine(e.Message); + } + } + public Bitmap GetImage() { + return bitmap; + } + + public void SaveImage() { + if (bitmap != null) { + bitmap.Save(@"F:\E\Curren_Running_Projects\WindowApplication\", ImageFormat.Jpeg); + } + } + + + private void button1_Click(object sender, EventArgs e) + { + WebClient Client = new WebClient(); + Client.DownloadFile("http://lurieunaward.com/1st_Alfredo_Sabat_cartoon2006.jpg", "F:\\1st_Alfredo_Sabat_cartoon2006.jpg"); + + Download(); + GetImage(); + SaveImage(); + //string str = "http://www.wallcoo.net/cartoon/index4.htm"; + + //string rs = httpHelper.getHtmlfromUrl(new Uri(str)); + + //lst = GetSourceTags(rs); + //lst1 = globusRegex.GetUrlsFromString(rs); + + } + + public List GetSourceTags(string HtmlData) + { + List lstAnchorUrl = new List(); + + Regex anchorTextExtractor = new Regex(@"src=[""'](?[^""^']+[.]*)[""'].*>"); + foreach (Match url in anchorTextExtractor.Matches(HtmlData)) + { + if (url.Value.Contains(".jpg")) + { + lstAnchorUrl.Add(url.Value); + } + } + + //String url = @""; + //String pattern = @"[^""]*)""\salt=""(?[^""]*)"; + //Regex rx = new Regex(pattern); + //Match m = rx.Match(HtmlData); + //if (m.Success) + //{ + // String newUrl = @" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Facebook Scraper/ImageCrawler.csproj b/Facebook Scraper/ImageCrawler.csproj new file mode 100644 index 0000000..e6f7f09 --- /dev/null +++ b/Facebook Scraper/ImageCrawler.csproj @@ -0,0 +1,93 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {FC8B58A9-FB29-4329-9C5C-2303E516B132} + WinExe + Properties + ImageCrawler + ImageCrawler + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\..\WebApplication\Modified TwtZilla\GlobusLib\bin\Debug\GlobusLib.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/Facebook Scraper/Program.cs b/Facebook Scraper/Program.cs new file mode 100644 index 0000000..c86039f --- /dev/null +++ b/Facebook Scraper/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace ImageCrawler +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Facebook Scraper/Properties/AssemblyInfo.cs b/Facebook Scraper/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..25e30a9 --- /dev/null +++ b/Facebook Scraper/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ImageCrawler")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ImageCrawler")] +[assembly: AssemblyCopyright("Copyright © 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b90f6051-edeb-4c4d-9131-851e7a907be0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Facebook Scraper/Properties/Resources.Designer.cs b/Facebook Scraper/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ba9d551 --- /dev/null +++ b/Facebook Scraper/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ImageCrawler.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ImageCrawler.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Facebook Scraper/Properties/Resources.resx b/Facebook Scraper/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Facebook Scraper/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Facebook Scraper/Properties/Settings.Designer.cs b/Facebook Scraper/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6848c40 --- /dev/null +++ b/Facebook Scraper/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ImageCrawler.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Facebook Scraper/Properties/Settings.settings b/Facebook Scraper/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Facebook Scraper/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +