make it look nicer
|
@ -9,7 +9,6 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
B408F0DD251F6D180043E3A4 /* AsyncImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B408F0DC251F6D180043E3A4 /* AsyncImage.swift */; };
|
B408F0DD251F6D180043E3A4 /* AsyncImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B408F0DC251F6D180043E3A4 /* AsyncImage.swift */; };
|
||||||
B408F0E5251F7AC50043E3A4 /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = B408F0E4251F7AC50043E3A4 /* Just.swift */; };
|
B408F0E5251F7AC50043E3A4 /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = B408F0E4251F7AC50043E3A4 /* Just.swift */; };
|
||||||
B408F0ED251F9D2C0043E3A4 /* loading.jpg in Resources */ = {isa = PBXBuildFile; fileRef = B408F0EC251F9D2C0043E3A4 /* loading.jpg */; };
|
|
||||||
B4F0CC7B251BE62B00E9EA74 /* vrtnuApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC7A251BE62B00E9EA74 /* vrtnuApp.swift */; };
|
B4F0CC7B251BE62B00E9EA74 /* vrtnuApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC7A251BE62B00E9EA74 /* vrtnuApp.swift */; };
|
||||||
B4F0CC7D251BE62B00E9EA74 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC7C251BE62B00E9EA74 /* ContentView.swift */; };
|
B4F0CC7D251BE62B00E9EA74 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC7C251BE62B00E9EA74 /* ContentView.swift */; };
|
||||||
B4F0CC7F251BE62F00E9EA74 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B4F0CC7E251BE62F00E9EA74 /* Assets.xcassets */; };
|
B4F0CC7F251BE62F00E9EA74 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B4F0CC7E251BE62F00E9EA74 /* Assets.xcassets */; };
|
||||||
|
@ -40,7 +39,6 @@
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
B408F0DC251F6D180043E3A4 /* AsyncImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncImage.swift; sourceTree = "<group>"; };
|
B408F0DC251F6D180043E3A4 /* AsyncImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncImage.swift; sourceTree = "<group>"; };
|
||||||
B408F0E4251F7AC50043E3A4 /* Just.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Just.swift; sourceTree = "<group>"; };
|
B408F0E4251F7AC50043E3A4 /* Just.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Just.swift; sourceTree = "<group>"; };
|
||||||
B408F0EC251F9D2C0043E3A4 /* loading.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = loading.jpg; sourceTree = "<group>"; };
|
|
||||||
B4F0CC77251BE62B00E9EA74 /* vrtnu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vrtnu.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
B4F0CC77251BE62B00E9EA74 /* vrtnu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vrtnu.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B4F0CC7A251BE62B00E9EA74 /* vrtnuApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = vrtnuApp.swift; sourceTree = "<group>"; };
|
B4F0CC7A251BE62B00E9EA74 /* vrtnuApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = vrtnuApp.swift; sourceTree = "<group>"; };
|
||||||
B4F0CC7C251BE62B00E9EA74 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
B4F0CC7C251BE62B00E9EA74 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||||
|
@ -94,7 +92,6 @@
|
||||||
B4F0CC6E251BE62B00E9EA74 = {
|
B4F0CC6E251BE62B00E9EA74 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B408F0EC251F9D2C0043E3A4 /* loading.jpg */,
|
|
||||||
B4F0CC79251BE62B00E9EA74 /* vrtnu */,
|
B4F0CC79251BE62B00E9EA74 /* vrtnu */,
|
||||||
B4F0CC8B251BE62F00E9EA74 /* vrtnuTests */,
|
B4F0CC8B251BE62F00E9EA74 /* vrtnuTests */,
|
||||||
B4F0CC96251BE62F00E9EA74 /* vrtnuUITests */,
|
B4F0CC96251BE62F00E9EA74 /* vrtnuUITests */,
|
||||||
|
@ -256,7 +253,6 @@
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
B408F0ED251F9D2C0043E3A4 /* loading.jpg in Resources */,
|
|
||||||
B4F0CC82251BE62F00E9EA74 /* Preview Assets.xcassets in Resources */,
|
B4F0CC82251BE62F00E9EA74 /* Preview Assets.xcassets in Resources */,
|
||||||
B4F0CC7F251BE62F00E9EA74 /* Assets.xcassets in Resources */,
|
B4F0CC7F251BE62F00E9EA74 /* Assets.xcassets in Resources */,
|
||||||
);
|
);
|
||||||
|
|
BIN
vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/.DS_Store
vendored
Normal file
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"filename" : "shopiconback.png",
|
||||||
"idiom" : "tv"
|
"idiom" : "tv"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
After Width: | Height: | Size: 6.0 KiB |
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"filename" : "shopiconfront.png",
|
||||||
"idiom" : "tv"
|
"idiom" : "tv"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
After Width: | Height: | Size: 14 KiB |
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"filename" : "shopiconmiddle.png",
|
||||||
"idiom" : "tv"
|
"idiom" : "tv"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
After Width: | Height: | Size: 7.7 KiB |
|
@ -5,6 +5,7 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "iconback@2x.png",
|
||||||
"idiom" : "tv",
|
"idiom" : "tv",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -5,6 +5,7 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "icontop@2x.png",
|
||||||
"idiom" : "tv",
|
"idiom" : "tv",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 6.5 KiB |
|
@ -5,6 +5,7 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "iconmiddle@2x.png",
|
||||||
"idiom" : "tv",
|
"idiom" : "tv",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 4.1 KiB |
|
@ -1,18 +1,22 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"filename" : "topshelft@1x.png",
|
||||||
"idiom" : "tv",
|
"idiom" : "tv",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "topshelft@2x.png",
|
||||||
"idiom" : "tv",
|
"idiom" : "tv",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "topshelft@1x-1.png",
|
||||||
"idiom" : "tv-marketing",
|
"idiom" : "tv-marketing",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "topshelft@2x-1.png",
|
||||||
"idiom" : "tv-marketing",
|
"idiom" : "tv-marketing",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 53 KiB |
|
@ -53,20 +53,27 @@ struct LoginView: View{
|
||||||
}
|
}
|
||||||
struct VRTNuView: View{
|
struct VRTNuView: View{
|
||||||
var vrtNu: VRTNu
|
var vrtNu: VRTNu
|
||||||
var body: some View {
|
w var body: some View {
|
||||||
NavigationView(){
|
NavigationView(){
|
||||||
List(vrtNu.getShows(), id: \.self){ show in
|
List(vrtNu.getShows(), id: \.title){ show in
|
||||||
NavigationLink(destination: ShowView(show: show)){
|
NavigationLink(destination: ShowView(show: show)){
|
||||||
HStack{
|
HStack{
|
||||||
AsyncImage(url: show.imageURL,placeholder: {
|
AsyncImage(url: show.imageURL,placeholder: {
|
||||||
//Image(name: "loading")
|
//Image(name: "loading")
|
||||||
Text("Loading...")
|
Text("Loading...")
|
||||||
}, image:{Image(uiImage:$0).resizable()}).frame(width: 300, height:300)
|
}, image:{
|
||||||
Text(show.title)
|
Image(uiImage:$0)
|
||||||
|
.resizable()
|
||||||
|
}).aspectRatio(contentMode: .fit).frame(width: 480, height:300)
|
||||||
|
VStack(alignment: .leading){
|
||||||
|
Text(show.title)
|
||||||
|
.padding()
|
||||||
|
Text(show.showURL.absoluteString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}.navigationTitle("Browse VRT Nu")//.listStyle(DefaultListStyle())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct ShowView: View {
|
struct ShowView: View {
|
||||||
|
@ -82,8 +89,12 @@ struct ShowView: View {
|
||||||
AsyncImage(url: episode.imageURL,placeholder: {
|
AsyncImage(url: episode.imageURL,placeholder: {
|
||||||
//Image(name: "loading")
|
//Image(name: "loading")
|
||||||
Text("Loading...")
|
Text("Loading...")
|
||||||
},image:{Image(uiImage:$0).resizable()}).frame(width: 300, height: 300)
|
},image:{Image(uiImage:$0).resizable()
|
||||||
Text(episode.name)
|
}).aspectRatio(contentMode: .fit).frame(width: 480, height:300)
|
||||||
|
VStack(alignment: .leading){
|
||||||
|
Text(episode.title).padding()
|
||||||
|
Text(episode.episodeurl)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +117,7 @@ struct VisibleShowView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//not used at the moment, we have an integrated view of seasons in the episode list
|
||||||
struct SeasonView: View {
|
struct SeasonView: View {
|
||||||
var season: Season
|
var season: Season
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
@ -116,7 +128,8 @@ struct SeasonView: View {
|
||||||
AsyncImage(url: episode.imageURL,placeholder: {
|
AsyncImage(url: episode.imageURL,placeholder: {
|
||||||
//Image(name: "loading")
|
//Image(name: "loading")
|
||||||
Text("Loading...")
|
Text("Loading...")
|
||||||
},image:{Image(uiImage:$0).resizable()}).frame(width: 300, height: 300)
|
},image:{Image(uiImage:$0).resizable()
|
||||||
|
}).aspectRatio(contentMode: .fit).frame(width: 480, height:300)
|
||||||
Text(episode.name)
|
Text(episode.name)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,52 +158,8 @@ struct VideoView: View {
|
||||||
|
|
||||||
struct ContentView_Previews: PreviewProvider {
|
struct ContentView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
SeasonView(season: VRTNu().getShows()[0].getSeasons()[0])
|
//ShowView(show: VRTNu().getShows()[0])
|
||||||
//ContentView()
|
ContentView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*struct OldContentView: View {
|
|
||||||
var body: some View {
|
|
||||||
NavigationView(){
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
ForEach(VRTNu().shows, id: \.self){ show in
|
|
||||||
VStack{
|
|
||||||
Text(show.title)
|
|
||||||
HStack{
|
|
||||||
|
|
||||||
ForEach(show.seasons, id:\.self){ season in
|
|
||||||
|
|
||||||
List(season.episodes, id:\.self){ episode in
|
|
||||||
NavigationLink(destination: VideoView(url: episode.video.hlsUrl)){
|
|
||||||
VStack{
|
|
||||||
Text(season.seasonName)
|
|
||||||
Text(episode.name)
|
|
||||||
AsyncImage(url: episode.imageurl,placeholder: {
|
|
||||||
//Image(name: "loading")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
Text("Loading...")
|
|
||||||
},image:{Image(uiImage:$0).resizable()})
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,16 @@ let just = JustOf<HTTP>()
|
||||||
struct Episode: Hashable, Comparable{
|
struct Episode: Hashable, Comparable{
|
||||||
|
|
||||||
static func < (lhs: Episode, rhs: Episode) -> Bool {
|
static func < (lhs: Episode, rhs: Episode) -> Bool {
|
||||||
return lhs.name < rhs.name
|
return lhs.name.localizedStandardCompare(rhs.name) == .orderedAscending
|
||||||
}
|
}
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
|
let title: String
|
||||||
let season: Season
|
let season: Season
|
||||||
let imageURL: URL
|
let imageURL: URL
|
||||||
let metadataurl: URL
|
let metadataurl: URL
|
||||||
|
let episodeurl: String
|
||||||
|
|
||||||
|
|
||||||
func authenticated() -> Bool{
|
func authenticated() -> Bool{
|
||||||
//check if current token is valid
|
//check if current token is valid
|
||||||
|
@ -58,11 +61,13 @@ struct Episode: Hashable, Comparable{
|
||||||
return video
|
return video
|
||||||
}()
|
}()
|
||||||
|
|
||||||
init(season: Season, episodeName: String, imageURL: URL){
|
init(season: Season, episodeName: String, title: String, imageURL: URL){
|
||||||
self.name = episodeName
|
self.name = episodeName
|
||||||
self.season = season
|
self.season = season
|
||||||
self.imageURL = imageURL
|
self.imageURL = imageURL
|
||||||
self.metadataurl = URL(string: "https://www.vrt.be/vrtnu/a-z/" + season.show.showName + "/" + season.seasonName + "/" + episodeName + ".mssecurevideo.json")!
|
self.episodeurl = "https://www.vrt.be/vrtnu/a-z/" + season.show.showName + "/" + season.seasonName + "/" + episodeName
|
||||||
|
self.metadataurl = URL(string: episodeurl + ".mssecurevideo.json")!
|
||||||
|
self.title = title
|
||||||
}
|
}
|
||||||
|
|
||||||
func getVideo() -> Video{
|
func getVideo() -> Video{
|
||||||
|
@ -104,7 +109,8 @@ func parseData(data: String, regexPattern: String) -> [String]{
|
||||||
|
|
||||||
struct Season: Hashable, Comparable{
|
struct Season: Hashable, Comparable{
|
||||||
static func < (lhs: Season, rhs: Season) -> Bool {
|
static func < (lhs: Season, rhs: Season) -> Bool {
|
||||||
return lhs.seasonName < rhs.seasonName
|
//return lhs.seasonName < rhs.seasonName
|
||||||
|
return lhs.seasonName.localizedStandardCompare(rhs.seasonName) == .orderedAscending
|
||||||
}
|
}
|
||||||
|
|
||||||
static func == (lhs: Season, rhs: Season) -> Bool {
|
static func == (lhs: Season, rhs: Season) -> Bool {
|
||||||
|
@ -121,19 +127,25 @@ struct Season: Hashable, Comparable{
|
||||||
|
|
||||||
let regexPattern = "vrtnu/a-z/" + show.showName + "/" + seasonName + "/([^\"]*)/"
|
let regexPattern = "vrtnu/a-z/" + show.showName + "/" + seasonName + "/([^\"]*)/"
|
||||||
let imageregexPattern = "data-responsive-image=\".*(jpg|png)"
|
let imageregexPattern = "data-responsive-image=\".*(jpg|png)"
|
||||||
|
let titleregexPattern = "\">(.*)(</a>|<br />)"
|
||||||
|
|
||||||
let data = Just.get("https://www.vrt.be/vrtnu/a-z/" + show.showName + "/" + seasonName + ".lists.all-episodes/").text!
|
let data = Just.get("https://www.vrt.be/vrtnu/a-z/" + show.showName + "/" + seasonName + ".lists.all-episodes/").text!
|
||||||
let output = Array(Set(parseData(data: data, regexPattern: regexPattern)))
|
let output = parseData(data: data, regexPattern: regexPattern)
|
||||||
let imageoutput = parseData(data: data, regexPattern: imageregexPattern)
|
let imageoutput = parseData(data: data, regexPattern: imageregexPattern)
|
||||||
|
let titleoutput = parseData(data: data, regexPattern: titleregexPattern)
|
||||||
|
print(data)
|
||||||
|
|
||||||
var episode: String
|
var episode: String
|
||||||
var myepisodes: [Episode]
|
var myepisodes: [Episode]
|
||||||
myepisodes = []
|
myepisodes = []
|
||||||
for i in 0 ..< output.count{
|
for i in 0 ..< titleoutput.count{
|
||||||
episode = output[i].replacingOccurrences(of: "vrtnu/a-z/" + show.showName + "/" + seasonName + "/", with: "").replacingOccurrences(of: "/", with: "")
|
// output always contains same url twice
|
||||||
|
episode = output[i * 2].replacingOccurrences(of: "vrtnu/a-z/" + show.showName + "/" + seasonName + "/", with: "").replacingOccurrences(of: "/", with: "")
|
||||||
print(episode)
|
print(episode)
|
||||||
print(seasonName)
|
print(seasonName)
|
||||||
let image = URL(string: imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:"))!
|
let image = URL(string: imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:"))!
|
||||||
myepisodes.append(Episode(season: self, episodeName: episode, imageURL: image))
|
let title = titleoutput[i].replacingOccurrences(of: "\">", with: "").replacingOccurrences(of: "<br />", with: "").replacingOccurrences(of: "</a>", with: "")
|
||||||
|
myepisodes.append(Episode(season: self, episodeName: episode, title: title, imageURL: image))
|
||||||
}
|
}
|
||||||
|
|
||||||
myepisodes.sort()
|
myepisodes.sort()
|
||||||
|
@ -159,8 +171,10 @@ struct Season: Hashable, Comparable{
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Show: Hashable, Comparable{
|
struct Show: Hashable, Comparable{
|
||||||
|
|
||||||
static func < (lhs: Show, rhs: Show) -> Bool {
|
static func < (lhs: Show, rhs: Show) -> Bool {
|
||||||
return lhs.showName < rhs.showName
|
//return lhs.showName < rhs.showName
|
||||||
|
return lhs.showName.localizedStandardCompare(rhs.showName) == .orderedAscending
|
||||||
}
|
}
|
||||||
|
|
||||||
static func == (lhs: Show, rhs: Show) -> Bool {
|
static func == (lhs: Show, rhs: Show) -> Bool {
|
||||||
|
@ -227,20 +241,25 @@ struct VRTNu: Hashable {
|
||||||
lazy var shows: [Show] = {
|
lazy var shows: [Show] = {
|
||||||
let regexPattern = "a href=\"/vrtnu/a-z/(.*).relevant"
|
let regexPattern = "a href=\"/vrtnu/a-z/(.*).relevant"
|
||||||
let imageregexPattern = "data-responsive-image=\".*(jpg|png)"
|
let imageregexPattern = "data-responsive-image=\".*(jpg|png)"
|
||||||
|
let titleregexPattern = ".relevant/\">(.*)</a>"
|
||||||
|
|
||||||
let data = Just.get("https://www.vrt.be/vrtnu/a-z/").text!
|
let data = Just.get("https://www.vrt.be/vrtnu/a-z/").text!
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
let output = parseData(data: data, regexPattern: regexPattern)
|
let output = parseData(data: data, regexPattern: regexPattern)
|
||||||
let imageoutput = parseData(data: data, regexPattern: imageregexPattern)
|
let imageoutput = parseData(data: data, regexPattern: imageregexPattern)
|
||||||
|
let titleoutput = parseData(data: data, regexPattern: titleregexPattern)
|
||||||
|
|
||||||
var show: String
|
var show: String
|
||||||
|
var title: String
|
||||||
var image: String
|
var image: String
|
||||||
var myshows: [Show]
|
var myshows: [Show]
|
||||||
myshows = []
|
myshows = []
|
||||||
for i in 0 ..< output.count{
|
for i in 0 ..< output.count{
|
||||||
show = output[i].replacingOccurrences(of: ".relevant", with: "").replacingOccurrences(of: "a href=\"/vrtnu/a-z/", with: "")
|
show = output[i].replacingOccurrences(of: ".relevant", with: "").replacingOccurrences(of: "a href=\"/vrtnu/a-z/", with: "")
|
||||||
image = imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:")
|
image = imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:")
|
||||||
myshows.append(Show(vrtNu: self, showName: show, title: show, imageURL: URL(string: image)!))
|
title = titleoutput[i].replacingOccurrences(of: ".relevant/\">", with: "").replacingOccurrences(of: "</a>", with: "")
|
||||||
|
myshows.append(Show(vrtNu: self, showName: show, title: title, imageURL: URL(string: image)!))
|
||||||
}
|
}
|
||||||
myshows.sort()
|
myshows.sort()
|
||||||
return myshows
|
return myshows
|
||||||
|
|