blog.speedstor.net -- A blog maintained by a pessimistic over-confident High-School kid.

Thursday, April 18, 2019

Youtube Reader - my new app that reads youtube

It is 6 days into the 14-day spring break, and just yesterday, I finished my youtube reader app. This app as I mentioned before takes youtube and make it in article form rather than in videos. Although this might be useless to most people, it is essential to me. I always have nothing against reading, but it is just that picking up a book is not as attractive as an option compared with watching youtube mindlessly. With I watch youtube, I always have an excuse of how it is educational and that I could learn things from it. But in the end, even if I did learn things, I also waste upward of 4 hours a day on it. From past records, this is proven to be non-sustainable. In response to the whole thing, I went ahead and made a youtube app that allows people to read. Every time I want to open up youtube, I would remind myself to use this app instead.

This app is beloaded with features, from logged in recommended feed to searching for videos, its all included. Each of those features took about a day to add, but it is still a fun process. I skipped literal sleep for one night and had 2 hours of sleep for 2 other nights. At the end of those 5 days, I do not think I could even function properly as a human being. Nevertheless, let's jump back to the topic sentence of this paragraph and talk about the features of this app of mind. First of all the features, is the ability to read youtube as an article which is within the name of the app. Initially, I was going to add search algorithms to add in the missing periods, commas, and new paragraphs, but my lack of sleep took over me, and the fact that I am tired of everything about coding on the 5th day made this impossible. But while that feature is not implemented, you can still read youtube pain-free, it is just that you need to use more of your brain when reading it. Second of all features is the inclusion of the dates and views under the video title. Although this thing might be taken for granted on the normal youtube website, it is not given in a youtube replica. While making the app, I was actually debating with myself if I should add it or not. In the end, because I really want to have this feature when I actually use this app, I added it in and it took more than 2 hours. Moving on, the consecutive feature is the sidebar. Again, this is always taken for granted in normal apps, but when you are making an app alone, everything proves to be a challenge. Because of how impossible it is to navigate around the app without the sidebar, I took the time in making it and, in result, that took a day of work. At that point, I was already very frustrated, to have the core feature working while having everything else not working is not a good feeling. You always get the feeling of that you are so close to finishing the app yet you are not(I do not want to correct my grammar no more), and that is why there are still several bugs that pre-exist in the app right now.

Tired of talking, the other features that the app has is the ability to save channels to the sidebar, login to youtube, and have the recommended feed as youtube normally offers. The last feature really puzzles me a lot, because of all the other youtube replicas could not add the recommended feed into their app, yet it is the most important part of youtube. Either way, I still added this feature on the last night which I did not sleep.

This blog is all over the place and I am not writing well, I am craving sleep right now, so I will allow myself to go to that instead, peace.





Friday, April 12, 2019

Spring Break

Today is the last day of school before a week of spring break. Although the holidays are not really my thing, I do look forward to this holiday a lot. And this is because I had already determined what I need to do during the spring break. It may end very badly, or it could end well. It all determines on my ability to focus on my work. During the spring break, I need to make the youtubeReader app in ios. Although I have faith in myself, I have never made a mobile app despite my numerous attempts at it. Mobile apps are always constraint by their creators, which are apple and google. These companies although smart are never able to make an intuitive developer ide for their platform. While I may be fluent in Java, the java in android is much more annoying because I need to learn their functions to control their apps. But nevertheless, because of all the failed attempts, I made before, I have hope that I would be able to figure it out this time.

As I said, today is the last day of school, and I really have no interest in completing my last day. I am writing this in class, not that I have anything in class, but my heart is elsewhere rather in the classroom. A holiday is just that lucrative in attracting my attention. Not promising myself, but I am sure that I am going to procrastinate. The only precaution that I could think of and would do is to force myself to play 45 minutes each day, so if I really experience burn-out that easily, at least I would have 2 to 3 days to secure my productivity. And because I have nothing to say no more, I would just go on and talk about my life recently.

It was 5 weeks ago, that I found out I do not suck at math. Although pre-calculus is easier than in other schools, I did pretty well compared with other classmates. For the longest time, I thought that I was bad at math. I still remember myself barely passing math exam in Hong Kong. The worst part about this is that I thought I was above average at that time. Although I was above average, just to have the feeling of acceptance to just get a barely passing mark surprise me now. The only reason for my change in attitude in studying is because of my parents' decision in delivering me to oversees for an education. It always bothers me how the presence of money could fix almost everything. My grade wasn't the best in Hong Kong, and with the help of my parent's money, I am here in the US just chomping on my grades(not to jinx myself). Back to the topic, I right now keep surprising myself in my test scores in math. Although there are about 60 free points in each test, to get only one mistake in a test is something above what I would imagine being possible.     I really do not know what I am saying, but I really want to write a blog today. Whatever, no one reads it anyway.

As I lost my desire in writing a blog, and my creativity in writing had been derived from the 2 "long"(not really that long) essay that I need to write in the last 2 days. Spring break is coming, I am glad that I am hopeful in not wasting it.

Because I never showed this in my blog, I am just going to include it in this in here. I made this like 8 months ago.

Wednesday, April 10, 2019

Karma - My "new" Macbook pro

When karma is referred, it is mostly referred to in a negative way, referred with the meaning of experiencing a consequence of a bad act. But it is yesterday that I found out this word could be used in the exact opposite. Yesterday,  I shared my troubles with how it is very annoying to develop a ios app on windows. I complained about how I need to download macOS and how if not, I need to download an incomplete Xcode on ubuntu which also cost me inconvenience. And because of Karma, and how I had helped people when I could, I was able to borrow a MacBook in the sequence of making and finishing a ios app.

As explained in the last blog, I am planning to make an app that makes youtube readable rather than watchable. Youtube is what takes up most of my time without ever being properly addressed, and the worst thing about it is that I always have an excuse for such behavior. I always argue with myself that youtube when being used right is educational and could be embraced. And even though I mostly stick to the educational things on youtube, the advertising and extra buttons that come with it will always take me more time than just reading an article. To make an app that translates a video into a transcript could trick the brain into being in a casual mood while taking in information easily.

And because I mostly just make desktop apps that suits myself and that these apps aren't as used and popularized as I think they should I am thinking of making an app in contrast. Not only an app is easier to advertise it is also a more complete package than just another website. Plus after I make the app, I could always easily translate that to a web app instead. With all that rubbish said, I have to make an app and I am determined to make an ios one. Problem is that I do not know swift and happy apple like people to force people in using their own devices to develop for their devices and there is no way around it. I argued with myself with making a VM, but I had done that before and it is not that great. VM always comes with hardware issues for me no matter what, and I have no idea how to completely avoid this behavior. (I really used the behavior pretty frequency in this blog, please someone donate me help in the form of vocabs). While I am determined to make an app, the path to such a result is fogged up by the fact that I do not have a mac. But this is when my friend, homestay brother that drove me crazy a week ago came in and allow me to use his computer till the end of spring break. At first, I could not believe it, but as I am writing this blog on a mac, I slowly came to the realization that I really need to hurry up on finishing the app so that I would not bother him by being in possession of his computer.

Right now, I need to finish an essay due on Friday so that I could work on my still unnamed app. The moral of this incident is that although people might not look like they could offer anything to you and would just drag you down, they might be in use no matter what.

P.S: Related to Karma, I also got to ride on a Camaro Bumblebee because I taught someone coding.

My newly acquired computer.

Get youtube automatic transcripts

A week ago, I finally went to making an app that allows people to read youtube rather than wasting their time and watching it. Right now, each video takes about 10 minutes for one person to finish, and I seek to improve this by making the option for people to speed read the transcript. Although I did not finish the app, I did figure out how to automatically get the transcript. And because I really do not have much thigs to say on my blog anymore, I would explain my process of finding this way of getting the transcript.

Firstly, like any of my other apps, I started with a search on google. While I expected a very straightforward answer and that I could immediately go to making an app, the truth is that it's not that simple and people do not just announce their findings when they find it. And this blog is also here to try to change it. With my unsuccessful google search, I was forced to go investigate youtube.com. Within Google Chrome's network debugging tab, there are a cluster of different sources when you visit the site. After examining each and one of them, I finally found that if you turn on transcription, a link of youtube.com/api/timedtext? is used to summon the transcript. But within the get tags of the link, there is a tag called signature and it is different every time you get expired. Youtube.com generates this link and allow their own website to access it. With that said, The signature has no way of just crack and generate ourselves and to reverse engineer a program that I don't even have access is proved to be out of my league. After that, I am only stuck with trying a different way.

Continuing investigating the network tag, I found out that you get a link of youtube.com?getTranscript. With this, I dung into it but hit a road block when I found it is reliant on a post parameter of token_session. If you do not know much about networking, I could tell you that a post parameter is way more difficult to fake compared to just a get parameter. A get parameter is located within a link while a post parameter could not even be seen and is mostly encoded. With that said, it means that the second method of faking a session_token was impossible, so I went back to the first method.

From that, I at that time had identified all the possible way of getting the automated transcript from youtube and that the first way seems to be easier. But still, I cannot figure out how to get the signature. But with luck on my side, and with days upon days of searching and investigating, I finally found the answer and it makes me feel like that I am the dumbest person on earth. The signature and the full link to get the transcript was always exsistant in the youtube video HTML page. Although it is encoded with simple text-formats, it was really visible and straightforward.

In the end, I found out how to get an automated generated transcript from youtube and could finally continuing in making an app for people to speed read youtube. I will be a long journey as because I need to learn android studio and Xcode. Although the answer that I found, in the end, is simple and laughable, it still increased my understanding of networking as because I now know all the in and out to how websites and server communicate.



Wednesday, April 3, 2019

Website AutoLogin Script

For the last week, I had been working on improving my school's grade checking system by duplicating it. This step was essential because the original system takes at least 10 seconds for people to even get a glimpse of what they have for their grade. Although this process definitely creates suspense in itself, one thing could not be argued to be useful because of their drawbacks. With this in mind, I took upon myself in bettering this system.

To do all this, the first thing that I needed to do is to auto login to this site. Fortunately, this site is still pretty high level and low budget and I didn't have too much trouble in reverse engineering it (the term does sound very impressive, but its just reading code). Unfortunately, even easy networking confuses me, and that is why I am here now trying to explain how to auto login a site here to save anyone a day of mindless trying.

  1. The first thing is cookies. It took me one to two hours to figure out what I needed to focus on is cookies. Cookies are what keep users from logging in and logging out. Although some site doesn't use cookies to log in users, most sites including youtube, Yahoo and the site I am working on uses it. Cookies in browsers could be stored for as long as one's lifetime, or as short as one browsing session. The timeout of a cookie is set by a server and users ideally would not be able to change it. 
  2. To emulate a browser in a script, I used the Httpurlconnection class in java because java is my most fluent programming language. In this class, the request and response headers are not very important, and if you do not know what they are, you have no need for them to make an auto login script. in the Httpurlconnection class, you could get your cookies through one of its function called get cookies(). After running this command, you could store everything inside a String array in accommodate for the multiple cookies that are present. 
  3. With the cookies stored in a String array, the next important thing you would want to do is not to restore the cookies when redirected to the login page. Because of the nature of some site confining users in only using their login for a session, they would expire the cookie once it is set. To refresh the cookie would only make the cookie immediately expired. (Till this point, it had already been 5 hours for me)
  4. After storing the cookies and not reloading it after being redirected to the login page, you are logged in as long as you insert the first cookie from your stored list. For some site, they would like to add post parameters to add security. If so, just copy it from the networking tool from chrome because there is no way around it. 
  5. Subsequent to your successful login, you would want to directly go to the site desired and get the html content you had always been wanting.
  6. Wala, you got data from a website from a script and could now automate data grabbing from websites. From this, you could notify yourself when your account had any changes or even storing your data on a visual program like rainmeter to remind yourself of your data.
Although I am aware that I did not explain everything in the utterly most simplistic way, I hope this information would help anyone that is stuck in their way of making an auto login script. And if anyone wanted to check out my version of my auto login script, they are welcome to check it out by downloading the zip or visiting it on GitHub. My program is also adapted to be a server so that I could receive and send requests to my main server for added efficiency.