Placeholder Image

字幕列表 影片播放

  • Hey, Tek, wait here today.

  • What we're going to be doing for you is building a pet project and you can follow along.

  • We're going to build visual Twitter.

  • It's essentially like a feat of images taken from the Twitter feed, and this is a pretty cool, neat project.

  • We're going to go through a number of a P.

  • I system, be a lot of fun, and I include you guys to follow along.

  • If you want to get some pet project, work onto your resume just as good resume filler material.

  • This video, by the way, is sponsored by hosting ER.

  • We're going to be using their service is or check him out.

  • Ho singer dot com slash tech lead.

  • They'll get you also that with domains, websites, all of that stuff, they'll get your pet project, hose it for you.

  • And online is a great value, and you can follow along.

  • As we build this Web site, make sure to use Code tech lead to get 15% off.

  • It is coffee time, by the way, and I thought I would do something a little bit of fun today.

  • Actually, this is Atlas Coffee Club.

  • I kind of looked around, found a nice coffee of the month club.

  • Tons of fun.

  • They send you a little postcard and then to tell you all about what the coffee is here.

  • Like they say that this one has notes of hazel eyes and brown sugar.

  • And so, if you want, drink the same coffee down drinking every month, they're being link in the description.

  • And that would just have some fun with this.

  • That's good.

  • All right, So what we're going to be creating today is visual Twitter, and we're going to just show you guys how you might put a service like this together.

  • Now, I want to give you one key piece of inside here before we start, which is that we're going to be gluing together a lot of pieces.

  • And it's funny because I have to consider myself like a glue engineer.

  • I would just take a lots of different pieces and glue them together, and I thought, Well, does that really make me like a programmer?

  • Am I a software engineer?

  • If while I do is just hook up different pieces together, I take a P I M.

  • Points of service.

  • Is that already?

  • But you know, systems framework to interest, glue them together and then present it in.

  • Ah, you I.

  • And that's essentially what general itself for engineers do.

  • And it's actually what a huge, perhaps offer engineering is all about.

  • Just glowing pieces together we're going to be using a number of micro service is today to get ourselves set up.

  • So let's take a look.

  • It's going to be fun, all right?

  • So the first thing we're going to do here is we're going to go over to hosting her dot com slash tech lead, and we're going to get ourselves a website set up such that we can actually build the service out, make sure to use Code Tech lead to get 15% off.

  • Since I already have a website here, I'm going to set up a South domain twitter dot tech lee pro dot com.

  • It's going to set this up with a private directory for this, and once I have to set up, I'll be able to ftp into it, and then we'll be able to add code to it and build out our program.

  • I'm going to be using visual studio code.

  • You can use any FTP editor, the one they have a plug in car theft.

  • AP simple and I'll be up to uses to configure and connected.

  • So now if I access Twitter thought Tech Lee pro the pump, then it would show me the site that I've created.

  • You know, I'm just running PHP info, and we're going to use PHP.

  • You can use to really any language that you want, but PHP is.

  • It's a pretty simple, basic language.

  • If you want the uses to get this set up, and the first thing we're going to do here is we're going to try to fetch the Twitter feed and just scrape that.

  • So if I look up San Francisco, I can see what that you are.

  • I was going to look like and I can just grab that so file, get contents and yeah, there you go.

  • You can see pretty much I've cloned the Twitter website.

  • All I've done is I've scraped and then I've put whatever it had there.

  • Now there's a few issues with what's going on here with the scraping process, and things are problematic.

  • Number one is we may get blacklisted.

  • They actually do have a developer a p I, which you can purchase from them.

  • But, you know, it's kind of expensive, and I'm not sure I want to buy that.

  • It turns out, actually that there are service is known as scrapers and their job.

  • Their whole job is that they will scrape websites for you and a proxy your request through thousands of random servers that they have, and they'll be able to just scrape websites for you and essentially prevent you from getting blocked.

  • These scrapers, you know they're essential.

  • They allow you access to data in your data is highly important, especially when there is no A p I, and you're able to get that data allows you to create service is unlocked barriers to be able to launch things.

  • And who knows, maybe later on, when you do become successful, you'll be able to actually afford to go by that data making deals, whatever it is that you need to do.

  • So if you're just out to build, like proof of concept, I would say like the scraper service is they may be great, actually, as an interim solution.

  • So there is this website we're going to check it out.

  • It's cause scraper ap I'm and I have a link for this in the description below as well.

  • If you're interested, Scraper a p I allows you to easily build scalable web scrapers.

  • It's an extremely simple A p I that they provide You just access a single your l a p I thought scraper ap dot com You passing your a p i t.

  • And then you tell them to your oath that you want, So we're going to just take this and plug it in.

  • All right.

  • Looking good there.

  • So now we're scraping the Twitter website through prophecy.

  • Your l's using this grape for a PR service.

  • You know, the code looks really clean.

  • It's essentially a one liner that just replaces that you are l Now what we're going to do is not that we have the data and we know that, you know, using the scraper service, we're not going to get blocked.

  • We're going to use regular expressions just rip out.

  • Are the images in here?

  • All right, so I spent a little time here, and I came up with a regular expression which is able to extract the your l's and then the images so we'll be able to show the images and the would be linked to them.

  • This cream mapping.

  • So things are getting printer interesting, though I'm able to show image I can tap on it and then is going to show the actual post.

  • So that's kind of neat.

  • And I realize that we're not doing paging.

  • And one interesting thing is that the scraper a p I they seemed like they may even be able to do some paging for you, like get some JavaScript going, and you can also dig deeper into this and get the additional your l's and fish those as well.

  • I think Twitter is doing that through JavaScript and fishing as a PR called through Jason.

  • I mean, you can also just pay for deterred ape yet, But this is kind of for demo purposes, not the last thing I want to show you here is that there's one more very interesting micro service that we could be using, and that is clout imaged the IAU.

  • So you may have noticed here that all these images are differently sized right, and they're actually pretty big, like I've manually resized these down to 300 pixels and with but and your reality, they're pretty big.

  • And so what I really want to do is crop each of these images to say through 100 by 300 pixels, right?

  • So we don't get all these spaces now.

  • Normally, the way you may have to do this is you have to use a popular imagery sizing library known as image magic.

  • The command line is called comfort, and you build the ticket image, fetch it, resize it, crop it, applying the filters you want.

  • And then you have to host that image.

  • And they have to set up like a CD in content delivery network in order to serve that image quickly, like you don't need the CD and if you don't want to.

  • But then images just load slowly, and so a general rule of thumb is any time you have image.

  • Heavy assets or service is that you want to be serving over the Internet.

  • They want those to be loaded quickly for the end user.

  • You're gonna want to use a CD and cloud the image.

  • The Ohio and we'll have a link for that.

  • The description, as well as a micro service pretty neat one, actually, that allows you to do all sorts of image conversions and filtering and cropping and re sizing.

  • And then they host that on their own CD ins for years.

  • So you don't have to do any of this image hosting by yourself.

  • Let's take a look at what they've got here very similar to scraper AP, which we were using.

  • This is also extremely simple, like that simple to use.

  • You essentially just give the euro.

  • You tell it what you want in the euro parameters and you pass in the euro of image that you want.

  • And they would just generate a brand new image for you.

  • And they will cash that image.

  • And, you know, they're fast.

  • They've got to set up their seed, Ian's when that print these images, I'm going to pass it through a special U R L through cloud the image which will instruct that that I just want to crop it to 300 by 300 pixels so that pretty much takes care of it.

  • It's so sleek.

  • And now if I had to reload my web page.

  • All right, this is looking good.

  • Now you So you can see here that I have managed to just size all of these images to 300 by 300 pixels.

  • One simple command line and you know it's all set up.

  • I can click on these and it goes into the actual Twitter post.

  • That's pretty much like a visual Twitter that I have been able to set up so pretty fun stuff here.

  • And one more thing we can do here is we can actually add the search field and just make sure that we're searching for whatever people want to look for here.

  • Yes.

  • Oh, that's interesting.

  • So see, using this technique, I'm able to look up the most recent images of, like, say, sun sets that have been posted to Twitter, which is actually a feature that even Twitter is not really exposing, right, like you can look up pictures of sunsets, but they're going to try and deliver for you the most relevant pictures.

  • But if you want to be up to date pictures, well, you know, this kind of thing seems like it's doing it.

  • I can put in the search here and check out the latest images from London, right?

  • Looks like people are having some ice cream over there having some drinks.

  • And, you know, this really only scrapes just that first page.

  • Which is why I'm searching the word pick, which just increases the chance that I'm gonna get some images here.

  • And yeah, you know, I can see, like, Seems like get this Was somebody going around Tokyo So kind of, in retrospect, I would say that actually the Twitter ap I maybe we should just used the AP.

  • I just paid for that because scraping the Twitter a p f eed is a little bit more difficult than I had anticipated, essentially, because they're messing around with JavaScript and stuff like that.

  • But Nick, a hostess on se ho stinger dot com slash tech lead scrape it using the scraper, a p I.

  • And if you have images, you can use a micro service like cloud and missed a Iot to resize images.

  • Get the hose on the CD in, You know, just for Maddie, make it fast performance and all of this.

  • You could be doing what you're drinking at list coffee from that list coffee club while watching the tack.

  • Lied.

  • So there we go.

  • That's a fun low project.

  • There's a few interesting things, though, that you want to know before we wrap up here.

  • And one is that scraping data is an amazing thing that I think people should learn how to do.

  • I think that especially as you're getting started, being able to scrape some day that you some of that stuff, it's going to be a great way to build a pretty cool, pretty fun prototype that's actually going to be able to get you some pretty impressive results.

  • Us.

  • Well, actually, you don't necessarily want to do this too much.

  • But as you're getting started is just a great way to start building, privatizing the ideas and projects off the ground, your building, things like these pet projects.

  • One of the best ways to fill out your resume and have good stories to talk about as you're going through interviews or even if you're not, even if you just want to build some things for fun that'll do for me.

  • If you like the video, give the like and subscribe, and I'll see you next time.

Hey, Tek, wait here today.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

"Visual Twitter "編程項目(網頁編碼技巧與教程)。 ("Visual Twitter" programming project (web coding tips & tutorial))

  • 1 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字