SM Ticket
Demo | Discontinued
DISCLAIMER This is just a fun project, and I don't have a lot of time to work on this. I'm a highschool student and the schedule is a pain in the ass. I just hope you can understand or learn something from my "fun" projects. Have fun coding.
DrX - SM Ticket is a API and a Website and can be accesible to anyone to get daily events, searches, and more in any SM Branch in the Philippines. This is not the official API being used by the professionals. This is just a fun project to upcoming programmers who are trying to have some fun in coding and such. Feel free to contribute and make some changes in the Issues page.
- Official Website of SM Ticket
- Help the victims of Hurricane Dorian
pip install -r requirements.txt
- Fetch Attractions Function (Coming Soon)
- Fetch Other Venues Function (Coming Soon)
- Fetch SM Venues Function (Coming Soon)
- Fetch Events Function (Coming Soon)
- Fetch Events View Function (Coming Soon)
- Search Function
import scrapy as sm
What we need to do is import scrapy.py In order to import it, the file must be in the same directory as scrapy.py, if it doesn't work use importlib
import scrapy as sm
sm.Search = Input("What to Search: ")
Now we will call one of the variables in Scrappy which is Search, The Search Variable contains what to search on SM Ticket, we want to know what the user really wants to search so we add Input (Any method is fine as long as you pass a string variable.)
import scrapy as sm
sm.Search = Input("What to Search: ")
try:
for article in sm.FetchMovieResults():
for x in range(0, int(article['results'])):
print(article['title'][x] + " | " + article['date'][x] + " | " + article['location'][x] + " | " + article['link'][x] + "\n")
except Exception as e:
print(e)
Now we want to add a try/except to make it neat and to know what caused the problem. Mostly the problem that users will meet is that if they search an invalid movie title it will return a 'NoneType' exception or a Iterable exception.
int(article['results'])
Now in the third example, why are we finding for the range of our results? Well its simple, we want to know how many results returned, lets say for example it returned a number of 9. Since we are in a for loop we want to print out on how many title, date, location, and link that the result gave.
# Let x be any integer number
article['title'][x]
As what it said, Let x be any integer number. As long as that number doesn't exceed on how many results are there in the search results it wont return an error. If you let x be '1' then it will print out the first title in the list.
# Gets only the "title" in a list
for article in FetchMovieResults():
print(article['title'])
# Gets only the "location" in a list
for article in FetchMovieResults():
print(article['location'])
# Gets only the "date" in a list
for article in FetchMovieResults():
print(article['date'])
# Gets the 'link' to the website to be scraped.
for article in FetchMovieResults():
print(article['link'])
# Specify what no. of list to show.
for article in FetchMovieResults():
print(article['link'][0])
# Gets all the list of search results.
for article in FetchMovieResults():
print(article['title'])
print(article)
# Gets all of them in an organized manner.
for article in FetchMovieResults():
for x in range(0, int(article['results'])):
print(article['title'][x] + " | " + article['date'][x] + " | " + article['location'][x] + " | " + article['link'][x] + "\n")
Title of Movie: Fate
[DrX] Link: https://smtickets.com/events/search/Fate
[DrX] Scraping ./.
[DrX] Finished Appending
SM Cinema Bacoor Fate Stay Night III - Spring Song | November 21, 2020 | SM CINEMA - BACOOR | https://smtickets.com/events/view/9470
SM Cinema Masinag Fate Stay Night III - Spring Song | November 21, 2020 | SM CINEMA - MASINAG | https://smtickets.com/events/view/9471
SM Cinema San Mateo Fate Stay Night III - Spring Song | November 21, 2020 | SM CINEMA - SAN MATEO | https://smtickets.com/events/view/9472
[+] November 13 - 14 2020 -> Creating and Updating Django | https://youtu.be/GMgXMCb0Hls
[+] November 12 2020 | 6:00 PM -> Updated Scraper
[+] November 11 2020 | 11:00 PM -> Creation of SM Ticket