Results 1 to 10 of 17
-
25th Jun 2010, 09:02 PM #1OPლ(ಠ益ಠლ)Website's:
extremecoderz.com[c#] IMDB Info Grabber (Full program)
Ok.
Here is a handy little application - fully working - that obtains information from IMDB.com.
Fundamentally you can go much further, but im releasing the code thus far so users can learn from the code and how its used.
useage: enter a movie URL into the textbox and click search.
Example: http://www.imdb.com/title/tt0892318/
Download Link (exe): http://www.coding.extremecoderz.com/IMDBGrabber.rar
Download Link (solution): http://www.coding.extremecoderz.com/IMDBsol.rar
Anyway. without further ado:
Form1.cs Source:
PHP Code:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using IMDBGrabber;
namespace IMDBGrabber
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private delegate void DisplayStatus(string info, int progress, int maxProgress);
private void Status(string info, int progress, int maxProgress)
{
toolStripProgressBar1.Maximum = maxProgress;
toolStripProgressBar1.Value = progress;
toolStripStatusLabel1.Text = info;
}
private delegate void DisplayOutput(
string title,
string desc,
string rating,
string votes,
string releaseDate,
string tagLine
);
private void Output(
string title,
string desc,
string rating,
string votes,
string releaseDate,
string tagLine
)
{
title_tb.Text = title;
desc_tb.Text = desc;
rating_tb.Text = rating + " (" + votes + ")";
releaseDate_tb.Text = releaseDate;
tagLine_tb.Text = tagLine;
}
private delegate void displayCoverDelegate(string imageURL);
private void DisplayCoverImage(string imageURL)
{
pictureBox1.Image = IMDB.getCover(imageURL);
}
private void button1_Click(object sender, EventArgs e)
{
Thread myThread = new Thread(DoWork);
myThread.Start();
}
private void DoWork()
{
DisplayStatus DisplayStatus = new DisplayStatus(Status);
DisplayOutput DisplayOutput = new DisplayOutput(Output);
displayCoverDelegate displayCoverDelegate = new displayCoverDelegate(DisplayCoverImage);
Invoke(DisplayStatus, "Connecting...", 1, 3);
object[] returnValues = IMDB.getInfo(textBox1.Text);
Invoke(DisplayOutput,
returnValues[0].ToString(),
returnValues[1].ToString(),
returnValues[2].ToString(),
returnValues[3].ToString(),
returnValues[4].ToString(),
returnValues[5].ToString()
);
Invoke(DisplayStatus, "Getting Cover Image...", 2, 3);
Invoke(displayCoverDelegate, returnValues[6].ToString());
Invoke(DisplayStatus, "Ready.", 3, 3);
}
}
}
PHP Code:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Web;
using System.Drawing;
namespace IMDBGrabber
{
class IMDB
{
public static string[] GetStringInBetween(string strBegin, string strEnd, string strSource, bool includeBegin, bool includeEnd)
{
string[] result = { "", "" };
int iIndexOfBegin = strSource.IndexOf(strBegin);
if (iIndexOfBegin != -1)
{
if (includeBegin)
{ iIndexOfBegin -= strBegin.Length; }
strSource = strSource.Substring(iIndexOfBegin
+ strBegin.Length);
int iEnd = strSource.IndexOf(strEnd);
if (iEnd != -1)
{
if (includeEnd)
{ iEnd += strEnd.Length; }
result[0] = strSource.Substring(0, iEnd);
if (iEnd + strEnd.Length < strSource.Length)
{ result[1] = strSource.Substring(iEnd + strEnd.Length); }
}
}
else
{ result[1] = strSource; }
return result;
}
public static object[] getInfo(string url)
{
HttpWebRequest WebReq;
HttpWebResponse WebResp;
Stream Answer;
StreamReader _Answer;
string[] result;
string ResponseOutput;
WebReq = (HttpWebRequest)WebRequest.Create(url);
WebReq.KeepAlive = false;
WebReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4";
WebReq.Method = "GET";
WebReq.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
WebReq.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (WebResp = (HttpWebResponse)WebReq.GetResponse())
{
Answer = WebResp.GetResponseStream();
_Answer = new StreamReader(Answer);
ResponseOutput = _Answer.ReadToEnd();
}
string
title,
description,
rating,
votes,
releaseDate,
tagLine,
coverURL;
// rating (VOtes), Main Team. Plot, Main Release Date, Cast
// Director,Release Date,Genre,Tagline,Plot,Cast,Runtime,Country,Langu age, that will be awesome IMHO
result = GetStringInBetween("name=\"title\" content=\"", "\">", ResponseOutput, false, false);
title = HttpUtility.HtmlDecode(result[0]);
result = GetStringInBetween("name=\"description\" content=\"", "\">", ResponseOutput, false, false);
description = HttpUtility.HtmlDecode(result[0]);
result = GetStringInBetween(" <b>", "</b> ", ResponseOutput, false, false);
rating = HttpUtility.HtmlDecode(result[0]);
result = GetStringInBetween("class=\"tn15more\">", "</a>", ResponseOutput, false, false);
votes = HttpUtility.HtmlDecode(result[0]);
result = GetStringInBetween("<h5>Release Date:</h5>\n<div class=\"info-content\">\n", "<", ResponseOutput, false, false);
releaseDate = HttpUtility.HtmlDecode(result[0]);
result = GetStringInBetween("<h5>Tagline:</h5>\n<div class=\"info-content\">\n", "<", ResponseOutput, false, false);
tagLine = HttpUtility.HtmlDecode(result[0]);
result = GetStringInBetween("<link rel=\"image_src\" href=\"", "<", ResponseOutput, false, false);
coverURL = HttpUtility.HtmlDecode(result[0]);
return new object[]
{
title,
description,
rating,
votes,
releaseDate,
tagLine,
coverURL
};
}
public static Image getCover(string url)
{
HttpWebRequest WebReq;
HttpWebResponse WebResp;
Image tempImage = null;
WebReq = (HttpWebRequest)WebRequest.Create(url);
WebReq.KeepAlive = false;
WebReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4";
WebReq.Method = "GET";
WebReq.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
WebReq.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (WebResp = (HttpWebResponse)WebReq.GetResponse())
{
System.IO.Stream _WebStream = WebResp.GetResponseStream();
tempImage = Image.FromStream(_WebStream);
}
return tempImage;
}
}
}
jayfella Reviewed by jayfella on . [c#] IMDB Info Grabber (Full program) Ok. Here is a handy little application - fully working - that obtains information from IMDB.com. Fundamentally you can go much further, but im releasing the code thus far so users can learn from the code and how its used. useage: enter a movie URL into the textbox and click search. Example: http://www.imdb.com/title/tt0892318/ Download Link (exe): http://www.coding.extremecoderz.com/IMDBGrabber.rar Rating: 5
-
25th Jun 2010, 09:05 PM #2Banned
Testing it out now!
Thanx
Preview
-
25th Jun 2010, 09:06 PM #3Member
Merci beaucoup
This is the staff, you have been banned
-
25th Jun 2010, 09:07 PM #4MemberWinning isn't always black and white.
</div>
</div>
<div class="info
-
25th Jun 2010, 09:07 PM #5MemberWebsite's:
FuzzyShare.comGreat tool, i wonder how useful this will be if it was a forum mod ...
-
25th Jun 2010, 09:09 PM #6OPლ(ಠ益ಠლ)Website's:
extremecoderz.comsec proto. ill fix it in the source.
-
25th Jun 2010, 09:09 PM #7Member
And when there is no poster available, its closing
Please correct those and an awesome piece buddy
-
25th Jun 2010, 09:10 PM #8
-
25th Jun 2010, 09:11 PM #9OPლ(ಠ益ಠლ)Website's:
extremecoderz.comThe whole point really is to take a look at the code and see what is being done and how to go about improving it. I will continue to carry on and make the program as i said, but thought the source could maybe be the beginning of a few personal projects for you guys
-
25th Jun 2010, 09:11 PM #10MemberWebsite's:
eih.bz pornDDL.me sexytattoochicks.tumblr.com
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
IMDb Info Grabber - Online
By Apathetic in forum Web Development AreaReplies: 113Last Post: 19th Sep 2012, 03:45 AM -
IMDB Info Grabber
By CJ in forum Web Development AreaReplies: 11Last Post: 14th Jan 2012, 11:04 AM -
IMDB Info Grabber
By soft2050 in forum Webmaster ResourcesReplies: 63Last Post: 1st Dec 2011, 12:07 PM -
DLE IMDb Grabber Pro
By Drinkordie in forum Webmaster ResourcesReplies: 0Last Post: 30th Sep 2011, 08:04 AM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...